On Thu, 31 Jan 2002, Mark Wilson wrote:
> I have a module that I want to use as a mixin.  I have defined a method
> within the module that attempts to assign a value to a hash 'slot':
>     module myMod
>         def mixinMethod(param1, param2)
>             @hashVar[param1] = param2
>         end
>     end
> I include this module into my class, and call 'mixinMethod'.  I get a
> NameError because, apparently, I have not told the program that 'hashVar' is
> a hash table.  Where should I do a Hash.new() or other initialization?

you just define a #initialize method in your module and you don't believe
those who say (or assume) that you can't.

you don't forget to call "super" first, to propagate up the chain of
methods of the same name. that chain goes through all modules and classes
that define a method of that name (in most sane cases it looks like a
"depth-first search").

________________________________________________________________
Mathieu Bouchard                   http://hostname.2y.net/~matju