Sha256: 2bb7f2e49fd320397c667d10f3c6345c4356de182e3055a99791c29ac4228a8a

Contents?: true

Size: 958 Bytes

Versions: 6796

Compression:

Stored size: 958 Bytes

Contents

# frozen_string_literal: true

class Pry
  class Command
    class 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_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
    end

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

Version data entries

6,796 entries across 6,792 versions & 31 rubygems

Version Path
ory-client-0.0.1.alpha29 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
primary_connect_proto-0.0.6 vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
ory-client-0.0.1.alpha28 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
primary_connect_proto-0.0.5 vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
ory-client-0.0.1.alpha27 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
ory-client-0.0.1.alpha24 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
primary_connect_proto-0.0.4 vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
primary_connect_proto-0.0.3 vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
ory-client-0.0.1.alpha23 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
ory-kratos-client-0.8.0.alpha2 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
ory-client-0.0.1.alpha21 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
ory-keto-client-0.7.0.alpha1 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
ory-keto-client-0.7.0.alpha0 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
ory-kratos-client-0.7.6.alpha7 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
ory-kratos-client-0.7.6.alpha6 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
ory-kratos-client-0.7.6.alpha5 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
ory-kratos-client-0.7.6.alpha4 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
ory-kratos-client-0.7.6.alpha3 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
ory-kratos-client-0.7.6.alpha1 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb
ory-kratos-client-0.7.5.alpha2 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/commands/jump_to.rb