Skip to content

Commit

Permalink
Update lib/pry/method.rb
Browse files Browse the repository at this point in the history
Ensure that `Object` constant is resolved at top-level.

Simply referring to `Object` (and not `::Object`) inside a binding looks up
up local constants called `Object`.
  • Loading branch information
banister committed Sep 12, 2012
1 parent aefbe85 commit 7297a47
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pry/method.rb
Expand Up @@ -67,7 +67,7 @@ def from_binding(b)
nil
else
method = begin
new(b.eval("Object.instance_method(:method).bind(self).call(#{meth_name.to_s.inspect})"))
new(b.eval("::Object.instance_method(:method).bind(self).call(#{meth_name.to_s.inspect})"))
rescue NameError, NoMethodError
Disowned.new(b.eval('self'), meth_name.to_s)
end
Expand Down

0 comments on commit 7297a47

Please sign in to comment.