Object.class_variable_set and get : class_variable_get « Reflection « Ruby






Object.class_variable_set and get


Object.class_variable_set(:@@x, 1)   # Private in Ruby 1.8
Object.class_variable_get(:@@x)      # Private in Ruby 1.8
Object.class_variable_defined?(:@@x) # => true; Ruby 1.9 and later

 

Related examples in the same category