From: transfire@... Date: 2006-07-11T23:21:19+09:00 Subject: Re: module private methods inheritance ? Sean O'Halpin wrote: > > This might do what you want: > > module A > def initialize > puts "From A" > end > end > > module B > def initialize > puts "From B" > end > def self.included(obj) > obj.class_eval { > def initialize > super # call this module's initialize > end > } > end > end > > module A > include B > end > > class C > include A > end > > c = C.new > __END__ > From B Execpt now you've just changed A which could break anything else using it. Actually I think J's use of initialize, rather then some other method was in a err. Yes? You can skip over ancestors using something like facet/kernel/as but initialize is a touchy matter --it's not something one generally defines in a module in the first place. Even so, if that's really wha is wanted.... require 'facet/kernel/as' class C include A def initialize as(B).initialize end end What does #as do? It get the UnboundMethod in B and binds it to C, and offers it up in a nice little Functor. You can bypass the Functor if you want with #send_as(B,:initialize). T.