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

Revert "make whereami more consistent [Fixes #383]"

This reverts commit 2e8881f59e.
This commit is contained in:
Conrad Irwin 2012-11-20 13:44:23 -08:00
parent 07137ee5e5
commit 5a240b2d0c

View file

@ -22,17 +22,9 @@ class Pry
def setup
@method = Pry::Method.from_binding(target)
if internal_binding?(target)
location = _pry_.backtrace.detect do |x|
!x.start_with?(File.expand_path('../../../../lib', __FILE__))
end
@file = location.split(":").first
@line = location.split(":")[1].to_i
else
@file = target.eval('__FILE__')
@line = target.eval('__LINE__')
end
end
def options(opt)
opt.on :q, :quiet, "Don't display anything in case of an error"
@ -54,10 +46,12 @@ class Pry
if opts.quiet? && (internal_binding?(target) || !code?)
return
elsif internal_binding?(target)
if @file.end_with?("bin/pry")
if target_self == TOPLEVEL_BINDING.eval("self")
output.puts "At the top level."
return
else
output.puts "Inside #{Pry.view_clip(target_self)}."
end
return
end
set_file_and_dir_locals(@file)