Class: PryMoves::Goto

Inherits:
TraceCommand show all
Defined in:
lib/commands/goto.rb

Instance Method Summary collapse

Methods inherited from TraceCommand

#initialize, #start_tracing, #stop_tracing, trace, #trace_obj, #traced_method?, #tracing_func

Methods included from TraceHelpers

#current_frame_digest, #current_frame_type, #debug_info, #frame_digest, #frame_type, #redirect_step?

Constructor Details

This class inherits a constructor from PryMoves::TraceCommand

Instance Method Details

#init(binding_) ⇒ Object



3
4
5
# File 'lib/commands/goto.rb', line 3

def init(binding_)
  @goto_line = @command[:param].to_i
end

#trace(event, file, line, method, binding_) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/commands/goto.rb', line 7

def trace(event, file, line, method, binding_)
  if @call_depth < 0 or
      @call_depth == 0 and event == 'return' and @method.within?(file, line)
    PryMoves.messages << "⚠️  Unable to reach line #{@goto_line} in current frame"
    return true
  end

  event == 'line' && @goto_line == line and
    @method[:file] == file and
    @call_depth == 0
end