Created
September 27, 2014 21:19
-
-
Save anonymous/8cd714e12842a71ae725 to your computer and use it in GitHub Desktop.
attr_accessor on top-level class instance variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class C | |
attr_accessor :v | |
@v = "I am at the top-level" | |
def initialize | |
@v = "I am inside an instance" | |
end | |
end | |
p C.new.v | |
p C.v #no worky |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment