Created
December 15, 2010 07:05
-
-
Save deepak/741716 to your computer and use it in GitHub Desktop.
how to get the local variables enclosed by a Binding
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
| p = Proc.new { foo = 12; p local_variables } | |
| # why is the two different? | |
| # what is the meaning of "_" variable | |
| p.call #["_", "p", "foo"] | |
| p.binding.eval("local_variables") #["_", "p"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment