On Dec 20, 2011, at 12:26 PM, Khat Harr wrote: > An instance variable is prefaced by @, where a class variable is > prefaced by @@. Here's a small example: > > class Thingy > @@thingies = 0 > def initialize(name) > @my_name = name > @@thingies += 1 > puts "A new thingy is here!" > end > > def whatsMyName > puts "This thingy is named '#{@my_name}'." > end > > def howMany? > puts "So far you have created #{@@thingies} thingies." > end > end > > The @@thingies class variable is shared by all instances of the class. > Changing that variable in any one of the classes will change it for all > of them. > > Is this what you were looking for? I think he is looking for class instance variables. class Foo @class_ivar = 3 def self.class_ivar() @class_ivar; end def bar(a) puts "#{a} + #{self.class.class_ivar} = #{a + self.class.class_ivar}" end end foo = Foo.new foo.bar(6) # 6 + 3 = 9 cr