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
45
46
47
48
49
50
51
52
53
|
# File 'lib/ruby-debug/commands/list.rb', line 45
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
41
42
43
|
# File 'lib/ruby-debug/commands/list.rb', line 41
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
31
32
33
34
35
36
37
38
|
# 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
elsif @match[2] == 'on'
self.class.always_run = true
print "Listing is on.\n"
return
elsif @match[2] == 'off'
self.class.always_run = false
print "Listing is off.\n"
return
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
|