Created
April 2, 2011 16:30
-
-
Save bratish/899622 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
# binding example from Programming Ruby by Dave Thomas | |
def get_a_binding | |
val = 123 | |
binding | |
end | |
val = "cat" | |
the_binding = get_a_binding | |
eval("val", the_binding) # => 123 | |
eval("val") # => "cat" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment