P
pete
It doesn't seem possible to dynamically extend modules once they have
already been included into a particular class. By dynamically extend,
I mean to include a module within another module. Directly opening up
the class and adding methods works fine. See this example:
http://pastie.org/418192 And also, if you "re-include" the original
module into your classes it will pick up the extension module's
methods.
So why doesn't including a module into another module affect classes
that have already included that first module?
The only alternative I've find is to loop through the ObjectSpace
(filtering on classes) and find out which class's ancestors include
the module I want to extend and then include my extension module
straight into the class.
Thanks for any help/understanding!
already been included into a particular class. By dynamically extend,
I mean to include a module within another module. Directly opening up
the class and adding methods works fine. See this example:
http://pastie.org/418192 And also, if you "re-include" the original
module into your classes it will pick up the extension module's
methods.
So why doesn't including a module into another module affect classes
that have already included that first module?
The only alternative I've find is to loop through the ObjectSpace
(filtering on classes) and find out which class's ancestors include
the module I want to extend and then include my extension module
straight into the class.
Thanks for any help/understanding!