From: Paul Brannan Date: 2002-07-04T03:48:06+09:00 Subject: Re: Mixin class methods On Thu, Jul 04, 2002 at 03:35:20AM +0900, Steve Tuckner wrote: > Try "extend" (see below): > > ---------------------------------- > module A > def b(x) > print x, "\n" > end > end > > class Foo > extend A > end > > Foo.b(3) ==> "3" > ---------------------------------- Be forewarned that class variables used in A are A's class variables, and not Foo's: module A def c=(x) @@c = x end def c @@c end end class Foo extend A end Foo.c = 3 p Foo.c #=> 3 class Bar extend A end p Bar.c #=> 3 I've been bitten by this before. Paul