Ross Bamford wrote:
> On Wed, 2006-02-15 at 22:53 +0900, raving_ruby_rider wrote:
> 
>> Is there a way to know about what
>> classes were defined by loading a script?
>>
> 
> I've done something like this before:
> 
>         sc, ec = [], []
>         # => [[], []]
> 
>         ObjectSpace.each_object(Class) { |c| sc << c }
>         # => 471
>         require 'generator'
>         # => true
>         ObjectSpace.each_object(Class) { |c| ec << c }
>         # => 473
> 
>         new_classes = ec - sc
>         # => [SyncEnumerator, Generator]
> 
>> If not, can the Ruby system be asked for a collection
>> of subclasses for a particular Class?
> 
> See above (the argument to each_object).
> 

Heh. If you make your terminal black and green and run this:

   ObjectSpace.each_object(Object) { |o| puts o }

... you will see the truth of the Matrix. :)

-dave