Class: PryExceptionExplorer::LazyFrame
- Inherits:
-
Object
- Object
- PryExceptionExplorer::LazyFrame
- 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)
-
- (LazyFrame) initialize(frame, frame_counter = 0, call_stack = nil)
constructor
A new instance of LazyFrame.
-
- (Class) klass
The class of the
selfof the frame. -
- (Symbol?) method_name
The name of the active method in the frame (or
nil). -
- (LazyFrame) prev
The caller frame.
-
- (Object) self
The object context of the frame (the
self).
Constructor Details
- (LazyFrame) initialize(frame, frame_counter = 0, call_stack = nil)
A new instance of LazyFrame
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
The class of the self of the frame.
20 21 22 |
# File 'lib/pry-exception_explorer/lazy_frame.rb', line 20 def klass @frame.eval("self.class") end |
- (Symbol?) method_name
The name of the active method in the frame (or nil)
30 31 32 |
# File 'lib/pry-exception_explorer/lazy_frame.rb', line 30 def method_name @frame.eval("__method__") end |
- (LazyFrame) prev
The caller frame.
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
The object context of the frame (the self).
25 26 27 |
# File 'lib/pry-exception_explorer/lazy_frame.rb', line 25 def self @frame.eval("self") end |