Lionel Thiry wrote:

> class Test
>   @a = "value"
> 
>   def self.a
>     @a
>   end
> 
>   def initialize
>     @@a = "value2"
>   end
> 
>   def a
>     @@a
>   end
> end
> 
> puts Test.a # output: value
> puts Test.new.a # output: value2
> 
> I don't understand (and I'm quite surprised), what is the difference in 
> terms of OO design between class variables, the @@a in the example 
> above, and class instance variables, the @a in the example?

Currently class variables are also shared between different classes that 
are part of the same inheritance tree. IMHO this is a rarely needed 
feature and you're better off using regular instance variables on the 
class (and referring to them via self.class.var from an instance).