Sha256: addca617e1cc1fe259971d13ad8f879a035d9bfaf033f47edf20c7349b47dfa3

Contents?: true

Size: 847 Bytes

Versions: 39

Compression:

Stored size: 847 Bytes

Contents

class Pry
  class Command::JumpTo < Pry::ClassCommand
    match 'jump-to'
    group 'Navigating Pry'
    description 'Jump to a binding further up the stack.'

    banner <<-'BANNER'
      Jump to a binding further up the stack, popping all bindings below.
    BANNER

    def process(break_level)
      break_level    = break_level.to_i
      nesting_level  = _pry_.binding_stack.size - 1
      max_nest_level = nesting_level - 1

      case break_level
      when nesting_level
        output.puts "Already at nesting level #{nesting_level}"
      when 0..max_nest_level
        _pry_.binding_stack = _pry_.binding_stack[0..break_level]
      else
        output.puts "Invalid nest level. Must be between 0 and " \
          "#{max_nest_level}. Got #{break_level}."
      end
    end
  end

  Pry::Commands.add_command(Pry::Command::JumpTo)
end

Version data entries

39 entries across 39 versions & 14 rubygems

Version Path
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/pry-0.12.2/lib/pry/commands/jump_to.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/pry-0.12.2/lib/pry/commands/jump_to.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/pry-0.12.2/lib/pry/commands/jump_to.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/commands/jump_to.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/commands/jump_to.rb
dadapush_client-1.0.1 vendor/bundle/ruby/2.3.0/gems/pry-0.11.3/lib/pry/commands/jump_to.rb
chess_engine-0.0.2 vendor/bundle/gems/pry-0.12.2/lib/pry/commands/jump_to.rb
chess_engine-0.0.1 vendor/bundle/gems/pry-0.12.2/lib/pry/commands/jump_to.rb
xaiml-0.1.3 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/commands/jump_to.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/commands/jump_to.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/commands/jump_to.rb
xaiml-0.1.2 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/commands/jump_to.rb
pry-0.12.2-java lib/pry/commands/jump_to.rb
pry-0.12.2 lib/pry/commands/jump_to.rb
pry-0.12.1 lib/pry/commands/jump_to.rb
pry-0.12.1-java lib/pry/commands/jump_to.rb
pry-0.12.0 lib/pry/commands/jump_to.rb
pry-0.12.0-java lib/pry/commands/jump_to.rb
xaiml-0.1.1 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/commands/jump_to.rb
xaiml-0.1.0 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/commands/jump_to.rb