Skip to content

Instantly share code, notes, and snippets.

Created September 27, 2014 21:19
Show Gist options
  • Save anonymous/8cd714e12842a71ae725 to your computer and use it in GitHub Desktop.
Save anonymous/8cd714e12842a71ae725 to your computer and use it in GitHub Desktop.
attr_accessor on top-level class instance variables
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