Class: PryExceptionExplorer::LazyFrame

Inherits:
Object
  • Object
show all
Defined in:
lib/pry-exception_explorer/lazy_frame.rb

Defined Under Namespace

Classes: NullFrame

Constant Summary

START_FRAME_OFFSET =

we need to jump over a few irrelevant frames to begin with

6

Instance Method Summary (collapse)

Constructor Details

- (LazyFrame) initialize(frame, frame_counter = 0, call_stack = nil)



13
14
15
16
17
# File 'lib/pry-exception_explorer/lazy_frame.rb', line 13

def initialize(frame, frame_counter = 0, call_stack = nil)
  @frame         = frame
  @frame_counter = frame_counter
  @call_stack    = call_stack
end

Instance Method Details

- (Class) klass



20
21
22
# File 'lib/pry-exception_explorer/lazy_frame.rb', line 20

def klass
  @frame.eval("self.class")
end

- (Symbol?) method_name



30
31
32
# File 'lib/pry-exception_explorer/lazy_frame.rb', line 30

def method_name
  @frame.eval("__method__")
end

- (LazyFrame) prev



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/pry-exception_explorer/lazy_frame.rb', line 35

def prev
  if @call_stack
    if @frame_counter < (@call_stack.size - 1)
      LazyFrame.new(@call_stack[@frame_counter + 1], @frame_counter + 1, @call_stack)
    else
      NullFrame.new
    end
  else
    LazyFrame.new(binding.of_caller(@frame_counter + START_FRAME_OFFSET), @frame_counter + 1)
  end
end

- (Object) self



25
26
27
# File 'lib/pry-exception_explorer/lazy_frame.rb', line 25

def self
  @frame.eval("self")
end