Class Debugger::MethodCommand
In: cli/ruby-debug/commands/method.rb
Parent: Command

Implements the debugger ‘method’ command.

Methods

execute   help   help_command   regexp  

Public Class methods

[Source]

    # File cli/ruby-debug/commands/method.rb, line 74
74:       def help(cmd)
75:         %{
76:           m[ethod] i[nstance] <obj>\tshow methods of object
77:           m[ethod] iv <obj>\t\tshow instance variables of object
78:           m[ethod] <class|module>\t\tshow instance methods of class or module
79:         }
80:       end

[Source]

    # File cli/ruby-debug/commands/method.rb, line 70
70:       def help_command
71:         'method'
72:       end

Public Instance methods

[Source]

    # File cli/ruby-debug/commands/method.rb, line 48
48:     def execute
49:       if @match[1] == "iv"
50:         obj = debug_eval(@match.post_match)
51:         obj.instance_variables.sort.each do |v|
52:           print "%s = %s\n", v, obj.instance_variable_get(v).inspect
53:         end
54:       elsif @match[1]
55:         obj = debug_eval(@match.post_match)
56:         print "%s\n", columnize(obj.methods.sort(), 
57:                                 self.class.settings[:width])
58:       else
59:         obj = debug_eval(@match.post_match)
60:         unless obj.kind_of? Module
61:           print "Should be Class/Module: %s\n", @match.post_match
62:         else
63:           print "%s\n", columnize(obj.instance_methods(false).sort(), 
64:                                   self.class.settings[:width])
65:         end
66:       end
67:     end

[Source]

    # File cli/ruby-debug/commands/method.rb, line 44
44:     def regexp
45:       /^\s*m(?:ethod)?\s+((iv)|(i(:?nstance\s+)?)\s+)?/
46:     end

[Validate]