class Byebug::IrbCommand - byebug-11.0.1 Documentation

# class Byebug::IrbCommand

Enter IRB from byebug's prompt

### Public Class Methods

description() click to toggle source

    # File lib/byebug/commands/irb.rb, line 18
        def self.description
          <<-DESCRIPTION
            irb

            #{short_description}
          DESCRIPTION
        end

regexp() click to toggle source

    # File lib/byebug/commands/irb.rb, line 14
    def self.regexp
      /^\s* irb \s*$/x
    end

short_description() click to toggle source

    # File lib/byebug/commands/irb.rb, line 26
    def self.short_description
      "Starts an IRB session"
    end

### Public Instance Methods

execute() click to toggle source

    # File lib/byebug/commands/irb.rb, line 30
    def execute
      return errmsg(pr("base.errors.only_local")) unless processor.interface.instance_of?(LocalInterface)

      # @todo IRB tries to parse $ARGV so we must clear it (see #197). Add a
      #   test case for it so we can remove this comment.
      with_clean_argv { IRB.start }
    end

### Private Instance Methods

with_clean_argv() { || ... } click to toggle source

    # File lib/byebug/commands/irb.rb, line 40
    def with_clean_argv
      saved_argv = $ARGV.dup
      $ARGV.clear
      begin
        yield
      ensure
        $ARGV.concat(saved_argv)
      end
    end