Aleksi Niemel<aleksi.niemela / cinnober.com> writes:

> > We now have class variables in 1.5, so "pseudo class variable hack" is
> > no longer needed.
> 
> Good to know. Thanks.

Well, to be fair, the FAQ that you were commenting on says:

6.2 Are there class variables? 

As of Ruby 1.5.3, there are. A variable prefixed with two at signs is
a class variable, accessible within both instance and class methods of
the class.

  
    
      class CountEm
        @@children = 0
        def initialize
          @@children += 1
          @myNumber = @@children
        end
        def whoAmI
         "I'm child number #@myNumber (out of #@@children)"
        end
        def CountEm.totalChildren
          @@children
        end
      end

      c1 = CountEm.new
      c2 = CountEm.new
      c3 = CountEm.new
      c1.whoAmI              # -> "I'm child number 1 (out of 3)"
      c3.whoAmI              # -> "I'm child number 3 (out of 3)"
      CountEm.totalChildren  # -> 3