Sha256: 0478656dd5df40dac6cfa0651f6a7fb9c0729d9fd097f19f65d3dc013f634732

Contents?: true

Size: 845 Bytes

Versions: 214

Compression:

Stored size: 845 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

      case break_level
      when nesting_level
        output.puts "Already at nesting level #{nesting_level}"
      when (0...nesting_level)
        _pry_.binding_stack.slice!(break_level + 1, _pry_.binding_stack.size)

      else
        max_nest_level = nesting_level - 1
        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

214 entries across 207 versions & 33 rubygems

Version Path
pry-0.9.11.3-i386-mingw32 lib/pry/commands/jump_to.rb
pry-0.9.11.3-java lib/pry/commands/jump_to.rb
pry-0.9.11.2 lib/pry/commands/jump_to.rb
pry-0.9.11.2-i386-mswin32 lib/pry/commands/jump_to.rb
pry-0.9.11.2-i386-mingw32 lib/pry/commands/jump_to.rb
pry-0.9.11.2-java lib/pry/commands/jump_to.rb
pry-0.9.11.1 lib/pry/commands/jump_to.rb
pry-0.9.11.1-i386-mswin32 lib/pry/commands/jump_to.rb
pry-0.9.11.1-i386-mingw32 lib/pry/commands/jump_to.rb
pry-0.9.11.1-java lib/pry/commands/jump_to.rb
pry-0.9.11 lib/pry/commands/jump_to.rb
pry-0.9.11-i386-mswin32 lib/pry/commands/jump_to.rb
pry-0.9.11-i386-mingw32 lib/pry/commands/jump_to.rb
pry-0.9.11-java lib/pry/commands/jump_to.rb