Class: Byebug::ListCommand
Overview
Implements byebug “list” 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
40
41
42
43
44
45
46
|
# File 'lib/byebug/commands/list.rb', line 40
def description
%{l[ist]\t\tlist forward
l[ist] -\tlist backward
l[ist] =\tlist current line
l[ist] nn-mm\tlist given lines
* NOTE - to turn on autolist, use 'set autolist'}
end
|
.names ⇒ Object
36
37
38
|
# File 'lib/byebug/commands/list.rb', line 36
def names
%w(list)
end
|
Instance Method Details
#execute ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/byebug/commands/list.rb', line 20
def execute
Byebug.source_reload if Command.settings[:autoreload]
lines = LineCache::getlines @state.file, Command.settings[:autoreload]
if !lines
errmsg "No sourcefile available for #{@state.file}\n"
return @state.previous_line
end
b, e = set_line_range(Command.settings[:listsize], lines.size)
return @state.previous_line if b < 0
print "[#{b}, #{e}] in #{@state.file}\n"
@state.previous_line = display_list(b, e, lines, @state.line)
end
|
#regexp ⇒ Object
16
17
18
|
# File 'lib/byebug/commands/list.rb', line 16
def regexp
/^\s* l(?:ist)? (?:\s*([-=])|\s+(.+))? $/x
end
|