Class: Byebug::ListCommand
Overview
Implements byebug “list” command.
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match
Class Method Details
.description ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/byebug/commands/list.rb', line 29
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
25
26
27
|
# File 'lib/byebug/commands/list.rb', line 25
def names
%w(list)
end
|
Instance Method Details
#execute ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/byebug/commands/list.rb', line 9
def execute
Byebug.source_reload if Setting[:autoreload]
lines = getlines(@state.file, @state.line)
if !lines
errmsg "No sourcefile available for #{@state.file}\n"
return @state.previous_line
end
b, e = set_line_range(Setting[:listsize], lines.size)
return @state.previous_line if b < 0
print "\n[#{b}, #{e}] in #{@state.file}\n"
@state.previous_line = display_list(b, e, lines, @state.line)
end
|
#regexp ⇒ Object
5
6
7
|
# File 'lib/byebug/commands/list.rb', line 5
def regexp
/^\s* l(?:ist)? (?:\s*([-=])|\s+(\S+))? \s*$/x
end
|