From: Robert Klemme Date: 2008-05-06T00:35:03+09:00 Subject: Re: attr_accessor for class variable? On 05.05.2008 17:03, sayoyo Sayoyo wrote: > Is there an equivalent for attr_acessor for the class varialbles? or I > have to write a function each time I wish to exppse the class varaible > to other clasess? You can just use attr_* family of methods - but you need to apply them to a different object, namely the singleton class of the class object: irb(main):001:0> class Foo irb(main):002:1> class< attr_accessor :bar irb(main):004:2> end irb(main):005:1> end => nil irb(main):006:0> Foo.bar = 10 => 10 irb(main):007:0> Foo.bar => 10 irb(main):008:0> Kind regards robert