I've got a question about using alias_method with a class and a module.
The module gets included by the class. But I can't figure out how to
deal with the initialize method.
I could be wrong (of course!), but it looks to me like the aliasing
isn't working the way you think it should. Rather than
initialize_with_extras being triggered and then triggering Test's
initialize, only Test's initialize is being hit. Hrm. What happens if
you call initialize_with_extras just initialize and create a conflict?
Or maybe something like this?
I've got a question about using alias_method with a class and a module.
The module gets included by the class. But I can't figure out how to
deal with the initialize method.
I think this is because the class has "overwritten" the initialize
method from the module (sort of how a child class will do regarding
its parent). Hrm hrm hrm. basically, when you call test.new it goes to
the Test class and says, "Okay. Do i have an initialize method here?
Ah! Yes. Here it is." And runs it. If it didn't find one, it would
kick up to the module's initialize method, or if the initialize method
for the class called on the module's... Remember that the chain
looking for methods trickles UP the inheritence chain and that
including modules is a similar chain.
Sorry I don't have another suggestion, but maybe that'll point you in
the right direction?
Ben
···
On Feb 9, 2008 2:36 PM, Leon Bogaert <leon@tim-online.nl> wrote: