Created
April 21, 2010 10:12
-
-
Save apeiros/373654 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# If you like f'ing around with people using your code, you can do | |
def stupid(arg, newval, b) | |
lvars = eval("local_variables",b) | |
relevant = lvars.find { |lvar| eval(lvar, b).equal?(arg) } | |
Thread.current[:stupid] = newval | |
relevant.each do |lvar| eval("#{lvar} = Thread.current[:stupid]", b) end | |
end | |
a = 1 | |
stupid(a, 2, binding) | |
p a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment