Module: CoreExt::Module::RetroactiveModuleInclusion
- Defined in:
- lib/retroactive_module_inclusion.rb
Instance Method Summary collapse
-
#retroactively_include(mod) ⇒ Object
Includes
mod
retroactively, i.e., extending to all classes and modules which had includedself
beforehand.
Instance Method Details
#retroactively_include(mod) ⇒ Object
Includes mod
retroactively, i.e., extending to all classes and modules which had included self
beforehand.
22 23 24 25 26 27 28 29 30 |
# File 'lib/retroactive_module_inclusion.rb', line 22 def retroactively_include(mod) raise TypeError, "wrong argument type #{mod.class} (expected Module)" unless mod.is_a? ::Module # ::Module would in general be equivalent to Object::Module and simply Module would mean CoreExt::Module in this context pseudo_descendants.each do |pd| pd.module_eval { include mod } end self end |