class Pry::Command::JumpTo

Public Instance Methods

process(break_level) click to toggle source
# File lib/pry/commands/jump_to.rb, line 14
def process(break_level)
  break_level    = break_level.to_i
  nesting_level  = pry_instance.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_instance.binding_stack = pry_instance.binding_stack[0..break_level]
  else
    output.puts "Invalid nest level. Must be between 0 and " \
      "#{max_nest_level}. Got #{break_level}."
  end
end