From: Gary Wright Date: 2011-01-07T06:43:31+09:00 Subject: Re: Class Initialization? On Jan 6, 2011, at 3:06 PM, Kedar Mhaswade wrote: > > And in the process of explaining this, you also indirectly explained one > question that was lurking in my mind -- are the > attr_readers/writers/accessors available to class variables -- and as I > understand it, they are -- by way of your previous class << self > construct. Careful here. The attr* methods are manipulating instance variables and not class variables. instance variables: private to an object class instance variables: instance variables for an object that just happens to be a class class variables: nasty, confusing things that have the same name but not at all the same semantics as 'class variables' in other languages I think it is very unfortunate that a lot of introductory Ruby texts choose to emphasize class variables (@@foo) over plain old instance variables of a class (@foo for a class object). If there were one feature I would remove from Ruby (maybe in Ruby 2.0?) it would be class variables. Gary Wright