Module: PryNav
- Extended by:
- PryNav
- Included in:
- PryNav
- Defined in:
- lib/pry-nav.rb,
lib/pry-nav/tracer.rb,
lib/pry-nav/version.rb,
lib/pry-nav/commands.rb
Defined Under Namespace
Classes: Tracer
Constant Summary collapse
- TRACE_IGNORE_FILES =
Dir[File.join(File.dirname(__FILE__), '**', '*.rb')].map { |f| File.(f) }
- VERSION =
'1.0.0'
- Commands =
Pry::CommandSet.new do block_command 'step', 'Step execution into the next line or method.' do |steps| check_file_context :step, steps end block_command 'next', 'Execute the next line within the same stack frame.' do |lines| check_file_context :next, lines end block_command 'continue', 'Continue program execution and end the Pry session.' do check_file_context run 'exit-all' end helpers do def (action, times) pry_instance.binding_stack.clear # Clear the binding stack. throw( :breakout_nav, # Break out of the REPL loop and action: action, # signal the tracer. times: times, ) end # Ensures that a command is executed in a local file context. def check_file_context unless PryNav.check_file_context(target) raise Pry::CommandError, 'Cannot find local context. Did you use `binding.pry`?' end end end end
Instance Attribute Summary collapse
-
#current_remote_server ⇒ Object
Reference to currently running pry-remote server.
Instance Method Summary collapse
-
#check_file_context(target) ⇒ Object
Checks that a binding is in a local file context.
Instance Attribute Details
#current_remote_server ⇒ Object
Reference to currently running pry-remote server. Used by the tracer.
27 28 29 |
# File 'lib/pry-nav.rb', line 27 def current_remote_server @current_remote_server end |
Instance Method Details
#check_file_context(target) ⇒ Object
Checks that a binding is in a local file context. Extracted from github.com/pry/pry/blob/master/lib/pry/default_commands/context.rb
16 17 18 19 20 21 22 23 24 |
# File 'lib/pry-nav.rb', line 16 def check_file_context(target) file = if target.respond_to?(:source_location) target.source_location.first else target.eval('__FILE__') end file == Pry.eval_path || (file !~ /(\(.*\))|<.*>/ && file != '' && file != '-e') end |