diff --git a/lib/pry/core_extensions.rb b/lib/pry/core_extensions.rb index 7e1ef63c..1bd294e8 100644 --- a/lib/pry/core_extensions.rb +++ b/lib/pry/core_extensions.rb @@ -30,13 +30,13 @@ class Object begin instance_eval %{ def __binding_impl__ - binding + Kernel.binding end } rescue TypeError self.class.class_eval %{ def __binding_impl__ - binding + Kernel.binding end } end diff --git a/test/test_pry.rb b/test/test_pry.rb index 2199f16f..9406c54f 100644 --- a/test/test_pry.rb +++ b/test/test_pry.rb @@ -294,6 +294,11 @@ describe Pry do Pry.binding_for(_main_.call).should == TOPLEVEL_BINDING Pry.binding_for(_main_.call).should == Pry.binding_for(_main_.call) end + + it 'should return a binding with the right self for procs' do + proc = Proc.new {} + Pry.binding_for(proc).eval("self").should.equal? proc + end end