On Mon, 2007-01-22 at 04:21 +0900, Gregory Brown wrote: > On 1/21/07, Hemant Kumar <gethemant / gmail.com> wrote: > > > module A > > @foo = "Bar" > > class << self; attr_accessor :foo; end > > end > > > > p A.foo > > That's probably the same effect, and a little shorter, too. > And i missed that, you will have to use self.class.foo to access the module instance variable from instance methods. > > PS : Sometimes I really need to think hard to differentiate between a > > class and a module. > > Maybe you'd find this post interesting: http://tinyurl.com/25494o > Not exactly the same topic, but related > PS: hmm thanks.