class Byebug::IRBCommand

Implements byebug’s “irb” command.

def description

def description
  %{irb\tstarts an Interactive Ruby (IRB) session.
    IRB is extended with methods "cont", "n" and "step" which run the
    corresponding byebug commands. In contrast to the real byebug commands
    these commands don't allow arguments.}
end

def execute

def execute
  unless @state.interface.kind_of?(LocalInterface)
    print "Command is available only in local mode.\n"
    throw :debug_error
  end
  cont = IRB.start_session(get_binding)
  case cont
  when :cont
    @state.proceed
  when :step
    force = Command.settings[:forcestep]
    @state.context.step_into 1, force
    @state.proceed
  when :next
    force = Command.settings[:forcestep]
    @state.context.step_over 1, @state.frame_pos, force
    @state.proceed
  else
    print @state.location
    @state.previous_line = nil
  end
end

def names

def names
  %w(irb)
end

def regexp

def regexp
  /^\s* irb \s*$/x
end