Class: Byebug::IrbCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/byebug/commands/irb.rb

Overview

Enter IRB from byebug’s prompt

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, #match

Methods included from StringFunctions

#camelize, #prettify

Methods included from FileFunctions

#get_line, #get_lines, #n_lines, #normalize

Methods included from ParseFunctions

#get_int, #parse_steps, #syntax_valid?

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



26
27
28
29
30
# File 'lib/byebug/commands/irb.rb', line 26

def description
  prettify <<-EOD
    irb  Starts an Interactive Ruby (IRB) session.
  EOD
end

.namesObject



22
23
24
# File 'lib/byebug/commands/irb.rb', line 22

def names
  %w(irb)
end

Instance Method Details

#executeObject



13
14
15
16
17
18
19
# File 'lib/byebug/commands/irb.rb', line 13

def execute
  unless @state.interface.is_a?(LocalInterface)
    return errmsg(pr('base.errors.only_local'))
  end

  IRB.start(__FILE__)
end

#regexpObject



9
10
11
# File 'lib/byebug/commands/irb.rb', line 9

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