Class: Debugger::IRBCommand

### Home Classes Methods

### In Files

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

### Parent

Debugger::Command

### Methods

- ::help
- ::help_command
- #execute
- #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::IRBCommand

Implements debugger "irb" command.

### Public Class Methods

help(cmd) click to toggle source

    # File lib/ruby-debug/commands/irb.rb, line 108
          def help(cmd)
            %{
              irb [-d]\tstarts an Interactive Ruby (IRB) session.

    If -d is added you can get access to debugger state via the global variable
    $RDEBUG_state.

    irb is extended with methods "cont", "n" and "step" which
    run the corresponding debugger commands. In contrast to the real debugger
    commands these commands don't allow command arguments.
            }
          end

help_command() click to toggle source

    # File lib/ruby-debug/commands/irb.rb, line 104
    def help_command
      'irb'
    end

### Public Instance Methods

execute() click to toggle source

    # File lib/ruby-debug/commands/irb.rb, line 65
    def execute
      unless @state.interface.kind_of?(LocalInterface)
        print "Command is available only in local mode.\n"
        throw :debug_error
      end

      save_trap = trap("SIGINT") do
        throw :IRB_EXIT, :cont if $rdebug_in_irb
      end

      add_debugging = @match.is_a?(MatchData) && '-d' == @match[1]
      $rdebug_state = @state if add_debugging
      $rdebug_in_irb = true
      cont = IRB.start_session(get_binding)
      case cont
      when :cont
        @state.proceed
      when :step
        force = Command.settings[:force_stepping]
        @state.context.step(1, force)
        @state.proceed
      when :next
        force = Command.settings[:force_stepping]
        @state.context.step_over(1, @state.frame_pos, force)
        @state.proceed
      else
        file = @state.context.frame_file(0)
        line = @state.context.frame_line(0)
        CommandProcessor.print_location_and_text(file, line, @state.context)
        @state.previous_line = nil
      end

    ensure
      $rdebug_in_irb = nil
      $rdebug_state = nil if add_debugging
      trap("SIGINT", save_trap) if save_trap
    end

regexp() click to toggle source

    # File lib/ruby-debug/commands/irb.rb, line 59
    def regexp
      /^\s* irb
        (?:\s+(-d))?
        \s*$/
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.