5 ("\nFull Interface for " ++ this.name).postln;
7 // post the superclasses
8 ("\nSuperclasses: " ++ this.superclasses).postln;
14 this.class.dumpAllMethods;
18 var methodlist, superclasses, prependString, superPrependString, name;
19 methodlist = IdentitySet[];
21 { prependString = "\nClass Methods for ";
22 superPrependString = "\nClass Methods inherited from ";
23 name = this.asString.copyToEnd(5);
24 superclasses = name.asSymbol.asClass.superclasses;
26 { prependString = "\nInstance Methods for ";
27 superPrependString = "\nInstance Methods inherited from ";
29 superclasses = this.superclasses;
32 (prependString ++ name ++ "\n").postln;
33 this.methods.do({ arg meth;
34 var numargs, methname;
36 methodlist.add(methname);
37 numargs = meth.argNames.size - 1;
41 meth.argNames.do({ arg name, i;
42 if (i > 0, { // skip 'this'
51 // Methods for superclasses
52 superclasses.do({ arg superclass, superobject, supername;
55 superobject = superclass.class;
58 superobject = superclass;
61 supername = superobject.asString;
62 if(supername.containsStringAt(0, "Meta_"), { supername = supername.copyToEnd(5) });
63 (superPrependString ++ supername ++ "\n").postln;
64 superobject.methods.do({ arg meth;
65 var numargs, methname;
67 if(methodlist.includes(methname).not, {
68 methodlist.add(methname);
69 numargs = meth.argNames.size - 1;
73 meth.argNames.do({ arg name, i;
74 if (i > 0, { // skip 'this'
86 // include methods for Class
88 if(this.isMetaClass, {"\nMethods inherited from Class\n".postln; Class.dumpInterface; });
95 mList = IdentityDictionary.new; // repository for methods
96 this.collectMethods(mList); // get them
98 sc = this; // to print superclass chain
99 { sc != Object }.while({
100 (sc.name ++ " : ").post;
105 mList.asSortedArray.do({ |pair|
106 (pair[0] ++ " <" ++ pair[1].ownerClass.name ++ "-"
107 ++ pair[0] ++ ">").post;
108 (pair[1].argNames.size > 1).if({
110 pair[1].argNames.do({ |argname, i|
111 (i > 1).if({ ", ".post });
112 (i > 0).if({ argname.post; });
120 collectMethods { arg list;
121 // only collect if not Object or Class
122 ((this.name != \Object) && (this.name != \Class)).if({ this.methods.do({ |meth|
123 // if keys already includes methodname,
124 // then a subclass has overridden this superclass method, so don't add
125 list.keys.includes(meth.name).not.if({
126 list.put((meth.name.asString).asSymbol, meth);
129 superclass.asClass.collectMethods(list); // go up a level
135 this.findRespondingMethodFor(methodSymbol).ownerClass.openHelpFile;
138 // show all subclasses of this class sorted in alpha order (not tree order)
140 var list, listCollector;
141 // recursive function to collect class objects
142 listCollector = { arg node, l;
144 node.subclasses.do({ arg n; listCollector.value(n, l) });
147 listCollector.value(this, list); // do the recursion
148 list.sort({ arg a, b; a.name < b.name }) // sort it
149 .do({ arg n; // and iterate to post the class names (w/ supers)
151 n.superclasses.do({ arg s; (" : " ++ s.name).post; });
154 ("\n" ++ list.size.asString ++ " classes listed.").postln;