class Byebug::IrbCommand


Enter IRB from byebug’s prompt

def self.description

def self.description
  <<-EOD
    irb
    #{short_description}
  EOD
end

def self.regexp

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

def self.short_description

def self.short_description
  'Starts an IRB session'
end

def execute

def execute
  unless processor.interface.instance_of?(LocalInterface)
    return errmsg(pr('base.errors.only_local'))
  end
  # @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

def with_clean_argv

def with_clean_argv
  saved_argv = ARGV.dup
  ARGV.clear
  begin
    yield
  ensure
    ARGV.concat(saved_argv)
  end
end