On 8/3/07, dblack / rubypal.com <dblack / rubypal.com> wrote:
> Hi -
>
> On Sat, 4 Aug 2007, Kenneth McDonald wrote:
>
<snip>
> Modules are themselves objects.  That means that when you send a
> message to a module, it looks for that method in its lookup path.
> However, a module does not lie in its own lookup path (unless you
> include it in itself).
Hmm I think it might be useful to clarify this a little bit
when David talks about including a module in itself he means including
it into the lookup array of itself, this is done with extend, not with
include.
As a matter of fact you cannot do this:
module A
   def a; 110 end
   include self
end
it does not make sense either, right, however you can do this of course
module A
   def a; 132 end
   extend self
   p a
end
a different way to do this is
modue A
   def a; 222 end # that is a nice way to say 42 ;)
   module_function :a
end
Now a is not available as *public* instance method anymore it becomes *private*.

Cheers
Robert



-- 
[...] as simple as possible, but no simpler.
-- Attributed to Albert Einstein