Hi.

> I thought that Test.inc was a class method that could be called without 
> ever instantiating an object of class Test, and that therefore there 
> would be no "self".  Are you saying that Test is not just a class, but 
> is also an instance of some other class?  

There is an "internal", if makes it easier to understand, representation
of Test, so @@var is there. Kind of when creating t = Test.new, t points
to @@var on the "internal" class.

This is the way you can add or remove methods to a class already
defined, you change the representation on the "internal" class who
shares your change with all other objects of the same class, and
thinking this way, share that variable also.

Kind of when you write

class Test
    def method_one
       puts "one!"
    end
end
t1 = Test.new

and then, later

class Test
    def method_two
       puts "two"
    end
end
t2 = Test.new

you have BOTH methods on t1 and t2, not matter that t1 was defined
before it was added, you changed that "internal" class where t1 and t2
are using as reference. When you create a class variable, think it is
stored there.

Best regards,


----------------------------
EustŠ“uio "TaQ" Rangel
eustaquiorangel / yahoo.com
http://beam.to/taq
UsuŠ”io GNU/Linux no. 224050