From 5a240b2d0c7ecb4a315ab8eeb96b1e6531af94dc Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Tue, 20 Nov 2012 13:44:23 -0800 Subject: [PATCH] Revert "make whereami more consistent [Fixes #383]" This reverts commit 2e8881f59e2a9b2879194490bcd93cde4926fc22. --- lib/pry/commands/whereami.rb | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/pry/commands/whereami.rb b/lib/pry/commands/whereami.rb index 655209ad..121e642b 100644 --- a/lib/pry/commands/whereami.rb +++ b/lib/pry/commands/whereami.rb @@ -22,16 +22,8 @@ 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 + @file = target.eval('__FILE__') + @line = target.eval('__LINE__') end def options(opt) @@ -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)