From: "Marshall T. Vandegrift" Date: 2006-09-09T01:09:21+09:00 Subject: Re: [CHALLENGE] better alias_method ara.t.howard@noaa.gov writes: > even more distilled: > > harp:~ > cat a.rb > class C > def m() '' end > > include Module.new{ def m() 'a' end } > end > > p C.new.m > > > harp:~ > ruby a.rb > "" > > > i find that behviour quite suprising... in fact, it seems like a bug, but i'm > probably wrong... thoughts? Module inclusion is inheritance, so far as method look-up goes, right?: class A def m() '' end include Module.new{ def m() 'a' end } end A.ancestors # => [A, #, Object, Kernel] A.new.m # => "" Which is effectively the same as: class B; end class C < B def m() '' end end class B def m() 'a' end end C.ancestors # => [C, B, Object, Kernel] C.new.m # => "" Which isn't surprising at all. -Marshall