From: Robert Klemme Date: 2005-05-12T06:05:38+09:00 Subject: Re: How to force a method redefinition ? "dm1" schrieb im Newsbeitrag news:d5tq7n$sq3$1@online.de... > Hello, > i'm puzzeld by the following piece of code: > > $ cat tests.rb > > module B > def xx ; puts "in B" ; end > end > module C > def xx ; puts "in C"; end > end > module D > def xx ; puts "in D"; end > end > > include B ; xx > include C ; xx > include D ; xx > include B ; xx > include C ; xx > > $ ruby ./tests.rb > in B > in C > in D > in D > in D > > I expected > in B > in C > in D > in B > in C > > looks like include's are made only once. > > Is there another way of getting what i expect ? There are several ways. You can for example fetch methods from a module with "B.instance_method :xx" and then bind it to an instance. What do you need that for? Kind regards robert