Created
January 29, 2009 01:01
-
-
Save DylanFM/54292 to your computer and use it in GitHub Desktop.
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
module What | |
@foo = 'bar' | |
class Whatever | |
def change_foo | |
What.instance_variable_set(:@foo, "changed") | |
end | |
end | |
end | |
w = What::Whatever.new | |
p What.instance_variable_get(:@foo) | |
w.change_foo | |
p What.instance_variable_get(:@foo) | |
# >> "bar" | |
# >> "changed" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment