On Wed, 21 Dec 2005 itsme213 / hotmail.com wrote:

>
> Ara.T.Howard wrote:
>> this provide method re-use at both the class and module level.  it can be used
>> for a kind of multiple inheritence organizational style.
>>
>>      harp:~ > cat a.rb
>>      class Module
>>        def inherit other
>>          extend other::ClassMethods if defined? other::ClassMethods
>>          extend other::ModuleMethods if defined? other::ModuleMethods
> ** >          include other::ModuleMethods if defined?
> other::ModuleMethods
>>          include other::InstanceMethods if defined? other::InstanceMethods
>>          include other
>>        end
>>      end
>
> I did not understand the '**' line. Shouldn't it be:
>  - extend ClassMethods
>  - extend ModuleMethods
>  - include InstanceMethods
> ?

i'm using ModuleMethods to hold methods which can be called on either
instances or classes - like 'module_method :foo'.  so this modules needs both
to extend the current module and be included in it.

kind regards.

-a
-- 
===============================================================================
| ara [dot] t [dot] howard [at] noaa [dot] gov
| all happiness comes from the desire for others to be happy.  all misery
| comes from the desire for oneself to be happy.
| -- bodhicaryavatara
===============================================================================