From: Trans Date: 2007-06-24T19:47:39+09:00 Subject: Re: Can't include a module in Enumerable? On Jun 24, 4:37 am, "Pit Capitain" wrote: > Tom, here's something to experiment with. I haven't tested it extensively: > > class Module > alias :old_include :include > def include other > old_include other > if self.class == Module > this = self > ObjectSpace.each_object Module do |mod| > mod.module_eval do include this end if mod < self > end > end > end > end > > module Z > def x; "x"; end > end > > module Enumerable > include Z > end > > a = [1,2,3,4,5] > p a.x # => "x" > > Regards, > Pit Pit Smack Down! You go and solve the Double Inclusion Problem just like that!? There must be a large issue. Why wouldn't Matz have already pursued this? Granted, I see a little inefficiency, but nothing an Observer pattern couldn't mitigate. What say you? I'm Speechless. T.