Class: Byebug::ListCommand
Overview
List parts of the source code.
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
36
37
|
# File 'lib/byebug/commands/list.rb', line 29
def description
%(l[ist][[-=]][ nn-mm]
Lists lines of code forward from current line or from the place where
code was last listed. If "list-" is specified, lists backwards
instead. If "list=" is specified, lists from current line regardless
of where code was last listed. A line range can also be specified to
list specific sections of code.)
end
|
.names ⇒ Object
25
26
27
|
# File 'lib/byebug/commands/list.rb', line 25
def names
%w(list)
end
|
Instance Method Details
#execute ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/byebug/commands/list.rb', line 10
def execute
Byebug.source_reload if Setting[:autoreload]
lines = get_lines(@state.file)
return errmsg "No sourcefile available for #{@state.file}\n" unless lines
@match ||= match('list')
b, e = range(@match[2], lines.size)
return errmsg('Invalid line range') unless valid_range?(b, e, lines.size)
display_lines(b, e, lines)
@state.prev_line = b
end
|
#regexp ⇒ Object
6
7
8
|
# File 'lib/byebug/commands/list.rb', line 6
def regexp
/^\s* l(?:ist)? (?:\s*([-=])|\s+(\S+))? \s*$/x
end
|