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?

Thank you,
pedz
-- 
Posted via http://www.ruby-forum.com/.