Class: Orthoses::Walk
- Inherits:
-
Object
- Object
- Orthoses::Walk
- Defined in:
- lib/orthoses/walk.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(loader, root:) ⇒ Walk
constructor
A new instance of Walk.
Constructor Details
#initialize(loader, root:) ⇒ Walk
Returns a new instance of Walk.
5 6 7 8 |
# File 'lib/orthoses/walk.rb', line 5 def initialize(loader, root:) @loader = loader @root = root end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/orthoses/walk.rb', line 10 def call @loader.call.tap do |store| root = Object.const_get(@root) if @root.instance_of?(String) Utils.module_name(root)&.then { |root_name| store[root_name] } Orthoses::Utils.each_const_recursive(root) do |current, const, val| if val.kind_of?(Module) Utils.module_name(val)&.then do |val_name| Orthoses.logger.debug("Add [#{val_name}] on #{__FILE__}:#{__LINE__}") store[val_name] end end end end end |