Class: RubyJard::Commands::FrameCommand

Inherits:
Pry::ClassCommand
  • Object
show all
Includes:
ValidationHelpers
Defined in:
lib/ruby_jard/commands/frame_command.rb

Overview

Command used to explore stacktrace.

Instance Method Summary collapse

Methods included from ValidationHelpers

#validate_non_negative_integer!, #validate_positive_integer!, #validate_present!, #validate_range!

Constructor Details

#initialize(context = {}) ⇒ FrameCommand

Returns a new instance of FrameCommand.



23
24
25
26
# File 'lib/ruby_jard/commands/frame_command.rb', line 23

def initialize(context = {})
  super(context)
  @current_backtrace = (context[:session] || RubyJard::Session).current_backtrace
end

Instance Method Details

#processObject



28
29
30
31
32
33
# File 'lib/ruby_jard/commands/frame_command.rb', line 28

def process
  frame = validate_present!(args.first)
  frame = validate_non_negative_integer!(frame)
  frame = validate_range!(frame, 0, @current_backtrace.map(&:virtual_pos).compact.max)
  RubyJard::ControlFlow.dispatch(:frame, frame: frame)
end