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?)
return
elsif internal_binding?
output.puts "Could not find local context, did you use \`binding.pry\`?"
output.puts "Insert #{target_self.inspect}"
return
end

View File

@ -144,7 +144,7 @@ class Pry
# @return [Object] The value the local was set to.
def inject_local(name, value, b)
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
Thread.current[:__pry_local__] = nil
end