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

Don't rely on Thread constant [Fixes #629]

This commit is contained in:
Conrad Irwin 2012-07-04 00:19:24 -07:00
parent be95f6a3eb
commit 1d640ed9ec
2 changed files with 2 additions and 2 deletions

View file

@ -42,7 +42,7 @@ class Pry
if opts.quiet? && (internal_binding? || !code?) if opts.quiet? && (internal_binding? || !code?)
return return
elsif internal_binding? elsif internal_binding?
output.puts "Could not find local context, did you use \`binding.pry\`?" output.puts "Insert #{target_self.inspect}"
return return
end end

View file

@ -144,7 +144,7 @@ class Pry
# @return [Object] The value the local was set to. # @return [Object] The value the local was set to.
def inject_local(name, value, b) def inject_local(name, value, b)
Thread.current[:__pry_local__] = value.is_a?(Proc) ? value.call : value Thread.current[:__pry_local__] = value.is_a?(Proc) ? value.call : value
b.eval("#{name} = Thread.current[:__pry_local__]") b.eval("#{name} = ::Thread.current[:__pry_local__]")
ensure ensure
Thread.current[:__pry_local__] = nil Thread.current[:__pry_local__] = nil
end end