Mixin a module with initialize

I want to mixin a class, overwrite the initialize method, but I still
want to call the original initialize, how can I do this as simple as
possible?
class A def initialize #some code endend
module B def initialize #some way to call the original #some
other code endend
#then extend
A.include(B)

THANKS

Here’s a sketch of one approach:

In your module, you’ll need to override the module’s “self.included”
hook.
This gets passed the constant for the class you are being mixed into.

In the included hook, alias the original initialize to some other method
name. Then, create your own initialize method. In the new initialize
method,
call the alias to the original initialize method.

2011/3/3 pp [email protected]