On Mon, 24 Oct 2005, Pit Capitain wrote:

> Robert Klemme schrieb:
>> 1. Find them when you need them via ObjectSpace:
>> 
>> ObjectSpace.each_object(Module) {|m| subclasses << m if 
>> m.ancestors.include? cl}
>
> If you want to find subclasses of a *class* instead of a module, you can pass 
> the singleton class of the base class:
>
>  require "enumerator"
>
>  def get_subclasses(klass)
>    ObjectSpace.enum_for(:each_object, class << klass; self; end).to_a
>  end
>
> Horacio, if you need help to decipher this code, feel free to ask.

pit that's insanely cool - thanks!

-a
-- 
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| anything that contradicts experience and logic should be abandoned.
| -- h.h. the 14th dalai lama
===============================================================================