Class: Byebug::SourceCommand
Overview
Implements byebug “source” command.
Constant Summary
Constants inherited
from Command
Command::DEF_OPTIONS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
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
Class Method Details
.description ⇒ Object
30
31
32
|
# File 'lib/byebug/commands/source.rb', line 30
def description
%{source FILE\texecutes a file containing byebug commands}
end
|
.names ⇒ Object
26
27
28
|
# File 'lib/byebug/commands/source.rb', line 26
def names
%w(source)
end
|
Instance Method Details
#execute ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/byebug/commands/source.rb', line 11
def execute
return print SourceCommand.help(nil) if
SourceCommand.names.include?(@match[0])
file = File.expand_path(@match[1]).strip
return errmsg "File \"#{file}\" not found\n" unless File.exist?(file)
if @state and @state.interface
@state.interface.command_queue += File.open(file).readlines
else
Byebug.run_script(file, @state)
end
end
|
#regexp ⇒ Object
7
8
9
|
# File 'lib/byebug/commands/source.rb', line 7
def regexp
/^\s* so(?:urce)? (?:\s+ (.+))? $/x
end
|