On 17.10.2007 22:10, Perry Smith wrote:
> I am using this technique for class instance variables:
> 
> class << self
>   def set_foo(s)
>     @foo = s
>   end
>   alias :foo= :set_foo
> 
>   def foo
>     @foo
>   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