From: botp Date: 2010-10-07T09:52:04+09:00 Subject: Re: Why does Module#include exclude the module's metaclass? On Thu, Oct 7, 2010 at 7:33 AM, John Mair wrote: > When classes are inherited in Ruby the singleton classes are also > inherited: > > class A >  def self.hello >    puts "hello" >  end > end > > class B < A > end > > B.hello #=> "hello" ok. single inheritance > Yet with modules, this is not the case: > > module M >  def self.goodbye >    puts "goodbye" >  end > end > > class A >  include M > end > > A.goodbye #=> NameError class A include M include N end now, which goodbye?? > To get around this limitation many ppl resort to this ugly hack: sorry, ' prefer specs over hacks :-) module ClassMethods def goodbye puts "goodbye" end end #=> nil class A class << self include ClassMethods end end #=> # A.goodbye goodbye clearer, if i may say. best regards -botp