Class: PryNav::Tracer
Instance Method Summary collapse
-
#initialize(pry_start_options = {}) ⇒ Tracer
constructor
A new instance of Tracer.
- #process_command(command = {}) ⇒ Object
- #run ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(pry_start_options = {}) ⇒ Tracer
Returns a new instance of Tracer.
5 6 7 8 9 10 |
# File 'lib/pry-nav/tracer.rb', line 5 def initialize( = {}) @step_in_lines = -1 # Break after this many lines @frames_when_stepping = nil # Only break at this frame level @frames = 0 # Traced stack frame level @pry_start_options = # Options to use for Pry.start end |
Instance Method Details
#process_command(command = {}) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/pry-nav/tracer.rb', line 42 def process_command(command = {}) times = (command[:times] || 1).to_i times = 1 if times <= 0 case command[:action] when :step @step_in_lines = times @frames_when_stepping = nil true when :next @step_in_lines = times @frames_when_stepping = @frames true else false end end |
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pry-nav/tracer.rb', line 12 def run # For performance, disable any tracers while in the console. stop return_value = nil command = catch(:breakout_nav) do # Coordinates with PryNav::Commands return_value = yield {} # Nothing thrown == no navigational command end # Adjust tracer based on command if process_command(command) start else if @pry_start_options[:pry_remote] && PryNav.current_remote_server PryNav.current_remote_server.teardown end end return_value end |
#start ⇒ Object
34 35 36 |
# File 'lib/pry-nav/tracer.rb', line 34 def start set_trace_func method(:tracer).to_proc end |
#stop ⇒ Object
38 39 40 |
# File 'lib/pry-nav/tracer.rb', line 38 def stop set_trace_func nil end |