From: Minkoo Seo Date: 2006-07-09T16:32:40+09:00 Subject: Re: attr_reader as a class method ------=_Part_83953_25920001.1152430356848 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I've made a mistake. I should've call Foo::ONE instead of Foo.ONE when accessing constants. By doing so, I don't have to make any methods. Thanks. Sincerely, Minkoo Seo On 7/9/06, Ryan Davis wrote: > > > On Jul 9, 2006, at 12:17 AM, Minkoo Seo wrote: > > > I'd like to use attr_reader to introduce a class method. For example, > > the following is the code I've tried. > > > > irb(main):001:0> class Foo > > irb(main):002:1> ONE = 1 > > irb(main):003:1> end > > The example is simply flawed. ONE is a constant and can be accessed > from outside Foo as Foo.ONE without any extra code. attr_* don't > provide access to constants, only instance variables (including the > instance of a class). > > > ------=_Part_83953_25920001.1152430356848--