From: Charles Oliver Nutter Date: 2009-09-03T14:18:03+09:00 Subject: Re: Class#descendants? On Wed, Aug 12, 2009 at 2:39 PM, Joel VanderWerf wrote: > irb(main):001:0> ObjectSpace.each_object(Class) {|cl| p cl if cl < Numeric} > Bignum > Float > Fixnum > Integer > > But keep in mind: it's inefficient (so cache if you can), and it may not be > standard across rubies (jruby may not have it IIRC). It's useful for > interactive poking around though. This is actually the one each_object case we do support with general ObjectSpace support turned off, since we maintain a weak reference from parent to child classes (so we just walk everything from Object down; it's for our method-caching logic). - Charlie