On Sun, May 22, 2011 at 12:11 PM, Josh Cheek <josh.cheek / gmail.com> wrote:

> class Animal
>
>   def self.inherited(subclass)
>     children << subclass
>   end
>
>   def self.children
>     @children ||= []
>   end
>
>   def self.descendants
>     children.map do |child|
>       [child].concat child.descendants
>     end.flatten
>   end
>
> end
>
> Dog    =  Class.new Animal
> Cat    =  Class.new Animal
> Tabby  =  Class.new Cat
>
> RUBY_VERSION        # => "1.9.2"
> Animal.children     # => [Dog, Cat]
> Animal.descendants  # => [Dog, Cat, Tabby]
>
> Cat.descendants     # => [Tabby]
>
>

Accidentally pasted the code over the entire response >.<

I meant to say you could whip something up without too much effort (as 7stud
said, there is no standard way).