From: "David A. Black" Date: 2007-10-18T05:25:59+09:00 Subject: Re: Class instance variable idiom Hi -- On Thu, 18 Oct 2007, Perry Smith wrote: > Robert Klemme wrote: >> On 17.10.2007 22:10, Perry Smith wrote: >>> end >>> end >>> >>> Then to reference foo from an instance of the class (or subclass), I do: >>> >>> self.class.foo >>> >>> Is there a cleaner way, in particular for the reference of the class >>> instance variable, to do this? >> >> class << self >> attr_accessor :foo >> end >> >> robert > > Thanks! > > Do I still do the self.class.foo to access it? Yes. The call to attr_accessor will create singleton methods for use by the class object Foo. David -- Upcoming training from Ruby Power and Light, LLC: * Intro to Ruby on Rails, Edison, NJ, October 23-26 * Advancing with Rails, Edison, NJ, November 6-9 Both taught by David A. Black. See http://www.rubypal.com for more info!