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
31
32
33
34
35
36
37
38
39
|
# File 'lib/byebug/commands/list.rb', line 31
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
27
28
29
|
# File 'lib/byebug/commands/list.rb', line 27
def names
%w(list)
end
|
Instance Method Details
#execute ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/byebug/commands/list.rb', line 10
def execute
Byebug.source_reload if Setting[:autoreload]
lines = get_lines(@state.file)
unless 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
puts "\n[#{b}, #{e}] in #{@state.file}"
@state.previous_line = display_list(b, e, lines, @state.line)
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
|