James Coglan
8/21/2008 4:28:00 PM
[Note: parts of this message were removed to make it a legal post.]
>
>
> 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.