Class: Debugger::ListCommand
Overview
Constant Summary
Constants inherited
from Command
Command::DEF_OPTIONS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
commands, inherited, #initialize, load_commands, #match, method_missing, options
Class Method Details
.help(cmd) ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'lib/ruby-debug/commands/list.rb', line 37
def help(cmd)
%{
l[ist]\t\tlist forward
l[ist] -\tlist backward
l[ist] =\tlist current line
l[ist] nn-mm\tlist given lines
l[ist] on/off\tprint listing on every stop
}
end
|
.help_command ⇒ Object
33
34
35
|
# File 'lib/ruby-debug/commands/list.rb', line 33
def help_command
'list'
end
|
Instance Method Details
#execute ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/ruby-debug/commands/list.rb', line 7
def execute
if !@match || !(@match[1] || @match[2])
b = @state.previous_line ? @state.previous_line + 10 : @state.line - 5
e = b + 9
elsif @match[1] == '-'
b = @state.previous_line ? @state.previous_line - 10 : @state.line - 5
e = b + 9
elsif @match[1] == '='
@state.previous_line = nil
b = @state.line - 5
e = b + 9
else
b, e = @match[2].split(/[-,]/)
if e
b = b.to_i
e = e.to_i
else
b = b.to_i - 5
e = b + 9
end
end
@state.previous_line = b
display_list(b, e, @state.file, @state.line)
end
|
#regexp ⇒ Object
3
4
5
|
# File 'lib/ruby-debug/commands/list.rb', line 3
def regexp
/^\s*l(?:ist)?(?:\s*([-=])|\s+(.+))?$/
end
|