From: "Wayne E. Seguin" Date: 2007-08-02T00:38:42+09:00 Subject: Re: Help: Get list of modules which are included in the class --Apple-Mail-2--630371703 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed On Aug 01, 2007, at 08:56 , dohzya wrote: > Le mercredi 01 ao=FBt 2007 =E0 05:44 +0900, Wayne E. Seguin a =E9crit = : >> > There is a problem (him ! again ! Arrrrrrg (Monthy Python dixit (yeah > for Monthy Ruby !!! (sorry, I'll try to stop lisp-mod ;))))) > You should try this : > --- > module Module1; end > class Class1; include Module1 end > module Module2; end > class Class2 < Class1; include Module1 ; include Module2 end > > Class1.included_modules > Class2.included_modules > > Class1.directly_included_modules > Class2.directly_included_modules # see this result > > Class1.inherited_modules > Class2.inherited_modules > --- > > -- > Etienne Vallette d'Osia Etienne, Thank you very much for this feedback. After thinking about it, here =20 is my take on this: We include Module1 in Class1 and so from inheritence this implies =20 that Class2 does not actually include Module1 directly, since it has =20 already been included. Hence including Module1 in Class2 is =20 effectively a no-op. This makes semantic sense, also: "directly_included_modules" should =20 be the modules that self includes which the superclass does not. In =20 this light Module1 is not directly included so my code does what is =20 expected. (Also, for the record, Module already has an included_modules method, =20= but I am overwriting because I don't want Kernel listed for my purposes) (Thanks to Mark Josef for helping me with this idea) -- Wayne E. Seguin Sr. Systems Architect & Systems Admin wayneseguin@gmail.com --Apple-Mail-2--630371703--