Re: instance_eval/class_eval including/extending modules
by Dave Thomas other posts by this author
Aug 31 2008 8:28PM messages near this date
Re: instance_eval/class_eval including/extending modules
|
Re: instance_eval/class_eval including/extending modules
On Aug 31, 2008, at 9:50 PM, Patrick Li wrote:
> 5)
> include myModule <-- evaluates the instructions in myModule,
> underneath
> selfClass
>
> 6)
> extend myModule <-- evaluates the instructions in myModule, underneath
> self
>
> Does that seem correct now? Thanks for your help by the way. That's
> quite a bit more clear n
No evaluation takes place. The module is already "compiled", and Ruby
simply links a proxy for that module in to the parent class chain for
either the class or metaclass. That way, module functionality is
shared between multiple classes/objects that include/extend the module.
Dave
Thread:
Pedro Silva
David A. Black
Pedro Silva
David A. Black
Pedro Silva
David A. Black
Pedro Silva
Patrick Li
botp
Dave Thomas
Patrick Li
Dave Thomas
Patrick Li
|