Sha256: 462f1a20b09713685bad2ac57a059e00836886a0ff1b797410b13ead2ff91533
Contents?: true
Size: 1.14 KB
Versions: 39
Compression:
Stored size: 1.14 KB
Contents
module Debugger class MethodCommand < Command # :nodoc: def regexp /^\s*m(?:ethod)?\s+(?:(i(:?nstance)?)\s)?/ end 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 class << self def help_command 'method' end 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 end end end
Version data entries
39 entries across 39 versions & 1 rubygems