From: Robert Dober Date: 2007-07-25T18:52:33+09:00 Subject: Re: Help: Get list of modules which are included in the class On 7/25/07, dohzya wrote: > Le mercredi 25 juillet 2007 � 18:24 +0900, Robert Dober a �crit : > > On 7/25/07, dohzya wrote: > > > How about (C2.ancestors - [C2] - C2.superclass.ancestors) ? > > You got it, indeed it was not so chellanging after all :( > > > > > > Cheers > > Robert > > > > There is a problem : > --- > module M1 ; end > module M2 ; end > class C1 ; include M1 ; end > class C2 < C1 ; include M1 ; include M2 ; end > > p (C2.ancestors - [C2] - C2.superclass.ancestors) # => [M2] > --- > I don't know if it is a severe problem... We have to ask OP, if he really wants to have M1 in this list I am afraid that Fred's metaprogramming track by using Module#included is the only way, maybe it would be nice if OP could tell us what this is for. > > -- > Etienne Vallette d'Osia > > > Cheers Robert -- I always knew that one day Smalltalk would replace Java. I just didn't know it would be called Ruby -- Kent Beck