From: James Coglan Date: 2008-08-22T01:27:41+09:00 Subject: Re: Find all subclasses of a class/module ------=_Part_65893_25967165.1219336285307 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline > > > BEGIN { > class Class > def inherited other > super if defined? super > ensure > ( @subclasses ||= [] ).push(other).uniq! > end > > def subclasses > @subclasses ||= [] > @subclasses.inject( [] ) do |list, subclass| > list.push(subclass, *subclass.subclasses) > end > end > end > } That's probably more efficient than my version, but won't it fail to capture relationships of any pre-existing classes? Seems it will only affect classes defined after it has been loaded. ------=_Part_65893_25967165.1219336285307--