Skip to content

Instantly share code, notes, and snippets.

@deepak
Created December 15, 2010 07:05
Show Gist options
  • Select an option

  • Save deepak/741716 to your computer and use it in GitHub Desktop.

Select an option

Save deepak/741716 to your computer and use it in GitHub Desktop.
how to get the local variables enclosed by a Binding
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