Hehe,

I don't know which question you were answering but it definitely wasn't 
mine! :)

I asked why, when including a module, the singleton class is not also 
included. Whereas when performing class inheritance the singleton IS 
inherited.

I am just curious to the difference in behaviour; as I can't think of a 
reason why module inclusion would work differently to class inheritance 
:(

John

botp wrote:
> On Thu, Oct 7, 2010 at 7:33 AM, John Mair <jrmair / gmail.com> wrote:
>> end
>>
>> B.hello #=> "hello"
> 
> ok. single inheritance
> 
>> 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
> #=> #<Class:A>
> 
> A.goodbye
> goodbye
> 
> clearer, if i may say.
> 
> best regards -botp

-- 
Posted via http://www.ruby-forum.com/.