class_variable_set(p1, p2) public

Sets the class variable names by symbol to object.

   class Fred
     @@foo = 99
     def foo
       @@foo
     end
   end

   def Fred.foo
     class_variable_set(:@@foo, 101)      #=> 101
   end
   Fred.foo
   Fred.new.foo                             #=> 101
Show source
Register or log in to add new notes.