Skip to content

Instantly share code, notes, and snippets.

@phuesler
Created January 31, 2013 17:14
Show Gist options
  • Save phuesler/4684472 to your computer and use it in GitHub Desktop.
Save phuesler/4684472 to your computer and use it in GitHub Desktop.
class MyClass
@@myvar = "My Var"
def self.myvar
@@myvar
end
def self.myvar=(new_value)
@@myvar = new_value
end
def foo
puts 'foo'
end
end
o = MyClass.new
o.foo
puts o.class.myvar
o.class.myvar = "new value"
puts o.class.myvar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment