diff --git a/id.js b/id.js index 68a2dfa..f9f977a 100644 --- a/id.js +++ b/id.js @@ -122,6 +122,20 @@ proto.setClass = function setClass (newClass) { return exports._wrapClass(core.object_setClass(this.pointer, newClass.pointer)); } +/** + * Walks up the inheritance chain and returns an Array of Strings of + * superclasses. + */ +proto.ancestors = function ancestors () { + var rtn = [] + , c = this.getClass() + while (c) { + rtn.push(c.getName()) + c = c.getSuperclass() + } + return rtn +} + /** * Returns an Array of Strings of the names of methods that the current object * will respond to. This function can iterate through the object's superclasses