Sha256: 08c990083327f665a77708b756b76ace28e307a216a67a80661de706ed8204ea

Contents?: true

Size: 1.14 KB

Versions: 29

Compression:

Stored size: 1.14 KB

Contents

require 'pry' unless defined? Pry

module PryNav
  Commands = Pry::CommandSet.new do
    block_command 'step', 'Step execution into the next line or method.' do |steps|
      check_file_context
      breakout_navigation :step, steps
    end

    block_command 'next', 'Execute the next line within the same stack frame.' do |lines|
      check_file_context
      breakout_navigation :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 breakout_navigation(action, times)
        _pry_.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
end

Pry.commands.import PryNav::Commands

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/commands.rb