Skip to content

Instantly share code, notes, and snippets.

@jorrizza
Created January 3, 2012 15:01
Show Gist options
  • Save jorrizza/1555242 to your computer and use it in GitHub Desktop.
Save jorrizza/1555242 to your computer and use it in GitHub Desktop.
Module.class_variables
irb(main):001:0> class A
irb(main):002:1> @@variable = 'a'
irb(main):003:1> end
=> "a"
irb(main):004:0> class B < A
irb(main):005:1> end
=> nil
irb(main):006:0> B.class_variables
=> []
irb(main):007:0> B.class_variable_defined?(:@@variable)
=> true
irb(main):008:0> B.class_variable_get(:@@variable)
=> "a"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment