Ruby-Gtk and accessor methods

G

gabriele renzi

Hi gurus and nubys,

I was playing a little with ruby-Gtk2 , and I have to admit that this
a wonderful library, thanks to everybody that provided it.

Still, I can't understand something in the way bindings are done.

It seem that for many widgets there are 3 accessors for internal
variables,i.e. for Window's title we have

Window#title # reader, returns title
Window#title=(title) # writer, returns title
Window#set_title # writer, returns self


It's just my impression or this is the normal way ?
I mean the writer like 'attribute=' returns his argument while the
writer with "set_attribute" returns self .

Can I assume this is the behaviour of the whole Gtk stuff?



thanks in advance for any answer.
 
M

Masao Mutoh

Hi,

Still, I can't understand something in the way bindings are done.

It seem that for many widgets there are 3 accessors for internal
variables,i.e. for Window's title we have

Window#title # reader, returns title
Window#title=(title) # writer, returns title
Window#set_title # writer, returns self


It's just my impression or this is the normal way ?

In Ruby-GNOME2, it's normal.

See the rules below:
http://ruby-gnome2.sourceforge.jp/h...rsion+Rules#Accessors+(Setter/Getter+methods)
Can I assume this is the behaviour of the whole Gtk stuff?

Yes. It's applyed to the whole Ruby-GNOME2 stuff(not only Ruby/GTK).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top