Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @@y = 1
- class MyClass
- @@y = 2
- end
- p @@y # => 2
- class Foo
- @@x = 1
- end
- class Bar
- @@x = 2
- end
- Foo.class_variable_get(:@@x) # => 1
- Bar.class_variable_get(:@@x) # => 2
- class Foo
- @@x = 1
- end
- class Bar < Foo
- @@x = 2
- end
- Foo.class_variable_get(:@@x) # => 2
- Bar.class_variable_get(:@@x) # => 2
- @@y = 1
- class MyClass
- @@y = 2
- end
- p @@y
- @@y = 1
- @@y = 1
- class MyClass
- @@y = 2
- end
- p @@y
- puts MyClass.superclass #=> Object
- puts Object.class_variables #=> @@y
- $y = 1
- @@y = 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement