Class: Debugger::JumpCommand

### Home Classes Methods

### In Files

- lib/ruby-debug/commands/jump.rb

### Parent

Debugger::Command

### Methods

- ::help
- ::help_command
- #execute
- #numeric?
- #regexp

### Class/Module Index

Quicksearch

- Debugger
- Debugger::AddBreakpoint
- Debugger::Breakpoint
- Debugger::Context
- Debugger::ContinueCommand
- Debugger::DeleteBreakpointCommand
- Debugger::FinishCommand
- Debugger::HelpCommand
- Debugger::IRBCommand
- Debugger::InfoCommand
- Debugger::JumpCommand
- Debugger::KillCommand
- Debugger::ListCommand
- Debugger::LocalInterface
- Debugger::LocalInterface::Debugger
- Debugger::MethodCommand
- Debugger::MethodSigCommand
- Debugger::NextCommand
- Debugger::ParseFunctions
- Debugger::Processor
- Debugger::QuitCommand
- Debugger::ReloadCommand
- Debugger::SetCommand
- Debugger::ShowCommand
- Debugger::SkipCommand
- Debugger::SourceCommand
- Debugger::StepCommand
- Debugger::VarClassVarCommand
- Debugger::VarInheritCommand
- Debugger::VarLocalCommand
- Debugger::WhereCommand
- Printers
- Printers::Base
- Printers::Base::MissedArgument
- Printers::Base::MissedPath
- Printers::Plain
- Mocha
- Mocha::Call
- Mocha::Expectation
- Mocha::Mock
- MiniTest
- MiniTest::Assertions
- MiniTest::Expectations
- TestDsl
- TestDsl::ClassMethods
- TestDsl::Shared
- Kernel
- Module
- PrinterHelpers
- TestInterface

No matching classes.

# Debugger::JumpCommand

Implements debugger "jump" command

### Public Class Methods

help(cmd) click to toggle source

    # File lib/ruby-debug/commands/jump.rb, line 55
    def help(cmd)
      %{
        j[ump] line\tjump to line number (absolute)
        j[ump] -line\tjump back to line (relative)
        j[ump] +line\tjump ahead to line (relative)

        Change the next line of code to be executed.
       }
    end

help_command() click to toggle source

    # File lib/ruby-debug/commands/jump.rb, line 51
    def help_command
      ]jump]
    end

### Public Instance Methods

execute() click to toggle source

    # File lib/ruby-debug/commands/jump.rb, line 20
    def execute
      if !@match[1]
        errmsg pr("jump.errors.no_line_number")
        return
      end
      if !numeric?(@match[1])
        errmsg pr("jump.errors.bad_line_number", line: @match[1])
        return
      end
      line = @match[1].to_i
      line = @state.context.frame_line(0) + line if @match[1][0] == '+' or @match[1][0] == '-'
      if line == @state.context.frame_line(0)
        CommandProcessor.print_location_and_text(@state.context.frame_file(0), line, @state.context)
        return
      end
      file = @match[2]
      file = @state.context.frame_file(file.to_i) if numeric?(file)
      file = @state.context.frame_file(0) if !file
      case Debugger.current_context.jump(line, file)
      when 0
        @state.proceed
      when 1
        errmsg pr("jump.errors.not_possible")
      when 2
        errmsg pr("jump.errors.no_frame")
      when 3
        errmsg pr("jump.errors.no_active_code", file: file, line: line)
      end
    end

numeric?(object) click to toggle source

    # File lib/ruby-debug/commands/jump.rb, line 7
    def numeric?(object)
      true if Float(object) rescue false
    end

regexp() click to toggle source

    # File lib/ruby-debug/commands/jump.rb, line 11
    def regexp
      / ^\s*
         j(?:ump)? \s*
         (?:\s+(\S+))?\s*
         (?:\s+(\S+))?\s*
         $
      /x
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.