Class: Debugger::MethodCommand
- Inherits:
-
Command
- Object
- Command
- Debugger::MethodCommand
show all
- Defined in:
- lib/ruby-debug/commands/method.rb
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
|
# File 'lib/ruby-debug/commands/method.rb', line 45
def help(cmd)
%{
m[ethod] i[nstance] <obj>\tshow methods of object
m[ethod] <class|module>\t\tshow instance methods of class or module
}
end
|
.help_command ⇒ Object
41
42
43
|
# File 'lib/ruby-debug/commands/method.rb', line 41
def help_command
'method'
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/method.rb', line 7
def execute
if @match[1]
obj = debug_eval(@match.post_match)
len = 0
for v in obj.methods.sort
len += v.size + 1
if len > 70
len = v.size + 1
print "\n"
end
print "%s ", v
end
print "\n"
else
obj = debug_eval(@match.post_match)
unless obj.kind_of? Module
print "Should be Class/Module: %s\n", @match.post_match
else
len = 0
for v in obj.instance_methods(false).sort
len += v.size + 1
if len > 70
len = v.size + 1
print "\n"
end
print "%s ", v
end
print "\n"
end
end
end
|
#regexp ⇒ Object
3
4
5
|
# File 'lib/ruby-debug/commands/method.rb', line 3
def regexp
/^\s*m(?:ethod)?\s+(?:(i(:?nstance)?)\s)?/
end
|