class Pry::LastException

Attributes

bt_index[RW]
file[R]

@return [String]

returns the path to a file for the current backtrace. see {#bt_index}.
line[R]

@return [Fixnum]

returns the line for the current backtrace. see {#bt_index}.

Public Class Methods

new(exception) click to toggle source
# File lib/pry/last_exception.rb, line 15
def initialize(exception)
  @exception = exception
  @bt_index = 0
  @file, @line = bt_source_location_for(0)
end

Public Instance Methods

bt_source_location_for(index) click to toggle source
# File lib/pry/last_exception.rb, line 52
def bt_source_location_for(index)
  backtrace[index] =~ /(.*):(\d+)/
  [::Regexp.last_match(1), ::Regexp.last_match(2).to_i]
end
inc_bt_index() click to toggle source
# File lib/pry/last_exception.rb, line 57
def inc_bt_index
  @bt_index = (@bt_index + 1) % backtrace.size
end
method_missing(name, *args, &block) click to toggle source
Calls superclass method
# File lib/pry/last_exception.rb, line 21
def method_missing(name, *args, &block)
  if @exception.respond_to?(name)
    @exception.public_send(name, *args, &block)
  else
    super
  end
end
respond_to_missing?(name, include_all = false) click to toggle source
# File lib/pry/last_exception.rb, line 29
def respond_to_missing?(name, include_all = false)
  @exception.respond_to?(name, include_all)
end
wrapped_exception() click to toggle source

@return [Exception]

returns the wrapped exception
# File lib/pry/last_exception.rb, line 48
def wrapped_exception
  @exception
end