Permalink
Browse files

minor refactor to wtf command

  • Loading branch information...
1 parent a1a6306 commit a42eec885301faecdc2e79f2eaa85c3fc0289c2c @banister banister committed Jan 3, 2013
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/pry/commands/wtf.rb
View
@@ -26,9 +26,9 @@ def options(opt)
end
def process
- raise Pry::CommandError, "No most-recent exception" unless _pry_.last_exception
+ raise Pry::CommandError, "No most-recent exception" unless exception
- output.puts "#{text.bold('Exception:')} #{_pry_.last_exception.class}: #{_pry_.last_exception}\n--"
+ output.puts "#{text.bold('Exception:')} #{exception.class}: #{exception}\n--"
if opts.verbose?
output.puts with_line_numbers(backtrace)
else
@@ -38,12 +38,16 @@ def process
private
+ def exception
+ _pry_.last_exception
+ end
+
def with_line_numbers(bt)
Pry::Code.new(bt, 0, :text).with_line_numbers.to_s
end
def backtrace
- _pry_.last_exception.backtrace
+ exception.backtrace
end
def size_of_backtrace

0 comments on commit a42eec8

Please sign in to comment.