Ruby-Gtk and accessor methods

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.

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/hiki.cgi?Naming+and+Conversion+Rules#Accessors+(Setter%2FGetter+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).

···

On Tue, 16 Dec 2003 05:22:06 +0900 gabriele renzi surrender_it@rc1.vip.ukl.yahoo.com wrote:


.:% Masao Mutohmutoh@highway.ne.jp