From: Tony Arcieri Date: 2009-08-13T09:54:00+09:00 Subject: Re: Class#descendants? --0016369fa374ea3ac70470fb5e2c Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Oi, good catch. So the question remains... can this be done without ObjectSpace? On Wed, Aug 12, 2009 at 4:05 PM, Joel VanderWerf wrote: > Tony Arcieri wrote: > >> For what it's worth, here's my implementation, which doesn't use >> ObjectSpace. It's a bit less trivial and I wonder if it could be made >> better: >> >> http://gist.github.com/166800 >> >> Workarounds for ActiveSupport included, yay! >> > > Not all classes are constants... > > my_numbers = Class.new(Numeric) > > p Numeric.descendants > a = [] > ObjectSpace.each_object(Class) {|cl| a << cl if cl <= Numeric} > p a > > > -- > vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407 > > -- Tony Arcieri Medioh/Nagravision --0016369fa374ea3ac70470fb5e2c--