Module: IncludeAll
- Defined in:
- lib/include_all.rb
Overview
Module declaration
Instance Method Summary collapse
-
#include_all(*args) ⇒ Object
Include all (in the future, a subset) of functionality or classes in a newly-required module.
-
#list_objects ⇒ Object
Lists objects in the ObjectSpace on demand.
Instance Method Details
#include_all(*args) ⇒ Object
Include all (in the future, a subset) of functionality or classes in a newly-required module
Example require_all ‘module’ include_all
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/include_all.rb', line 13 def include_all(*args) added = list_objects() (added - $startup).each { |m| begin include m rescue TypeError => e # Do nothing end } $startup = added end |
#list_objects ⇒ Object
Lists objects in the ObjectSpace on demand
27 28 29 |
# File 'lib/include_all.rb', line 27 def list_objects ObjectSpace.each_object(Module).to_a end |