From: james.d.masters@... Date: 2007-03-16T00:25:09+09:00 Subject: Re: General Ruby OOP Question - using inheritance or include for shared attributes On Mar 15, 12:11 am, "Trans" wrote: > module X; def self.x; "x"; end; end > class Y; include X; end > Y.x #=> error > > IMHO It's unfortunate that this is the case --or at least that there's > not a method other than #include that can do it. I guess it's because > I wrote annotations, which turned out to be very tricky b/c of this. In the case of pulling in module methods as class (singleton) methods, you can use extend instead of include. Your second example rewritten with "extend" would work: module X; def x; "x"; end; end class Y; extend X; end Y.x #=> "x" Unfortunately, I'm fairly sure that would require separate modules for class methods (through extend) and instance methods (through include).