1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

support BasicObject instance's as value in Pry#inject_local

before:
[6] pry(main)> _pry_.inject_local :foo, BasicObject.new, Pry.toplevel_binding
NoMethodError: undefined method `is_a?' for #<BasicObject:0x007fbb49f1a048>
from /Users/giorgio/code/pry/lib/pry/pry_instance.rb:151:in `inject_local'
[7] pry(main)> exit

after:
[3] pry(main)> _pry_.inject_local :foo, BasicObject.new, Pry.toplevel_binding
=> #<BasicObject:0x3fc186707a4c>
[4] pry(main)> foo
=> #<BasicObject:0x3fc186707a4c>
This commit is contained in:
robert 2014-04-01 19:20:41 +02:00 committed by Ryan Fitzgerald
parent b23e9256ac
commit 21d4c1ddf9

View file

@ -148,7 +148,7 @@ class Pry
# The value the local was set to.
#
def inject_local(name, value, b)
value = value.is_a?(Proc) ? value.call : value
value = Proc === value ? value.call : value
if b.respond_to?(:local_variable_set)
b.local_variable_set name, value
else # < 2.1