From: Sandro Paganotti Date: 2008-11-19T18:59:49+09:00 Subject: Re: Is there a way to know what are the subclasses of a given class ? ------=_Part_115912_27890549.1227088984656 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks Peter :D That exactly what I was lloking for :) On Wed, Nov 19, 2008 at 10:49 AM, Peter Szinek wrote: > In your above example, B is not subclass of A (B is not even defined, just > A::B). > > Also, how about > > class A > class B > end > class C > end > D = E = F = 5 > end > > >> A.constants > => ["C", "B", "D", "F", "E"] > > What are you trying to do exactly? Maybe modules would be better? > > Cheers, > Peter > ___ > http://www.rubyrailways.com > http://scrubyt.org > > > On 2008.11.19., at 10:10, Sandro Paganotti wrote: > > [SOLVED] >> >> I just find out that you can call: >> >> A.constants --> ["B","C"] >> >> Thank you >> >> Sandro >> >> On Wed, Nov 19, 2008 at 10:10 AM, Sandro Paganotti < >> sandro.paganotti@gmail.com> wrote: >> >> Hello >>> >>> Do you know if there's a trick to retrieve a list of all the subclasses >>> of >>> a given class ? >>> >>> class A >>> class B >>> end >>> class C >>> end >>> end >>> >>> like A.subclasses --> [B,C] ? >>> >>> Thanks >>> Sandro >>> >>> -- >>> sandropaganotti.com >>> >>> >> >> >> -- >> Go outside! The graphics are amazing! >> > > -- Go outside! The graphics are amazing! ------=_Part_115912_27890549.1227088984656--