Hi --

On Tue, 21 Mar 2006, Iain D Broadfoot wrote:

> Edwin van Leeuwen said something:
>> Trans wrote:
>>> Gee. Once again I want my module methods inherited.
>>
>> I agree, I was actually going to look into it why it didn't work for me,
>> but now I know it's not my fault, but actually a problem with ruby :) So
>> thanks for saving me a couple of minutes of frustration :)
>
> One naive and ugly solution is:
>
> module Foo
>  def self.included c
>    c.instance_eval{
>      def self.foo
>        :foo
>      end
>
>      def self.bar
>        :bar
>      end
>    }
>  end
> end
>
> which works, but it's far from perfect.

You're taking the long road :-)

   module Foo
     def self.included(c)
       def c.foo
         :foo
       end
     end
     #...
   end


David

-- 
David A. Black (dblack / wobblini.net)
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)

"Ruby for Rails" chapters now available
from Manning Early Access Program! http://www.manning.com/books/black