Skip to content

Instantly share code, notes, and snippets.

@DylanFM
Created January 29, 2009 01:01
Show Gist options
  • Save DylanFM/54292 to your computer and use it in GitHub Desktop.
Save DylanFM/54292 to your computer and use it in GitHub Desktop.
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