From: "Nigel S.Ball" Date: 2001-10-27T11:23:56+09:00 Subject: [ruby-talk:23584] Re: "un"-including a module On Sat, 27 Oct 2001 03:32, you wrote: > Here's a quick question: if I include a module, is there any way to > uninclude it? > > Paul I think that in some situations you can achieve something similar to selectively including and excluding a module by using a delegate pattern. I have found this useful in fastcgi applications. require 'delegate' module Extra; def m2; print "C2-m2\n"; end; end class C0; def m1; end; def m2; end; end class C1; def m1; print "C1-m1\n"; end; end class C2; def m1; m2; end; include Extra; end c3 = SimpleDelegator.new(C0.new) # C3 with extra included c3.__setobj__(C2.new) c3.m2 # extra gone c3.__setobj__(C1.new) c3.m2 -- Nigel S. Ball Enesbe Sales Pty Ltd