Class: Byebug::IRBCommand
Overview
Implements byebug’s “irb” command.
Constant Summary
Constants inherited
from Command
Command::DEF_OPTIONS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
command_exists?, commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match, method_missing, options, register_setting_get, register_setting_set, register_setting_var, settings, settings_map, terminal_width
Class Method Details
.description ⇒ Object
98
99
100
101
102
103
104
|
# File 'lib/byebug/commands/repl.rb', line 98
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
|
.names ⇒ Object
94
95
96
|
# File 'lib/byebug/commands/repl.rb', line 94
def names
%w(irb)
end
|
Instance Method Details
#execute ⇒ Object
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/byebug/commands/repl.rb', line 66
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[:force_stepping]
@state.context.step_into 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.previous_line = nil
end
end
|
#regexp ⇒ Object
62
63
64
|
# File 'lib/byebug/commands/repl.rb', line 62
def regexp
/^\s* irb \s*$/x
end
|