From: Rick DeNatale Date: 2007-03-01T23:24:11+09:00 Subject: Re: How to get modules included by a class/module (not those from the superclasses) On 2/28/07, Pit Capitain wrote: > Including a module in a class that already has been included by one of > its superclasses doesn't change the inheritance hierarchy: > > module M > end > > class P > include M > end > > class C < P > end > > p C.ancestors # => [C, P, M, Object, Kernel] > > class C > include M > end > > p C.ancestors # => [C, P, M, Object, Kernel] This has changed in 1.9 (or at least as of a few months ago which was the last time I built 1.9) rick@frodo:~$ cat modtest.rb module M end class P include M end class C < P end p C.ancestors class C include M end p C.ancestors rick@frodo:~$ ruby1.8 modtest.rb [C, P, M, Object, Kernel] [C, P, M, Object, Kernel] rick@frodo:~$ ruby1.9 modtest.rb [C, P, M, Object, Kernel, BasicObject] [C, M, P, M, Object, Kernel, BasicObject] I wrote about this back in October http://talklikeaduck.denhaven2.com/articles/2006/10/09/a-subtle-change-to-mixin-semantics-in-ruby-1-9 -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/