Skip to content

Instantly share code, notes, and snippets.

@HashNuke
Created May 22, 2011 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HashNuke/985105 to your computer and use it in GitHub Desktop.
Save HashNuke/985105 to your computer and use it in GitHub Desktop.
> binding
#<Binding:0x0000000140aa28>
> binding.class
=> Binding
> respond_to? :binding
false
> defined? binding
"method"
> Object.binding
NoMethodError: private method `binding' called for Object:Class
msg = "hello"
def say
puts msg
end
say
# throws NameError since msg is not in scope
msg = "hello"
def say(scope)
eval "puts msg", scope
end
say(binding)
# prints hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment