Class: Dry::Effects::System::AutoRegistrar

Inherits:
System::AutoRegistrar
  • Object
show all
Defined in:
lib/dry/effects/extensions/system.rb

Instance Method Summary collapse

Instance Method Details

#call(component_dir) ⇒ Object

Always memoize and freeze registered components



12
13
14
15
16
17
18
# File 'lib/dry/effects/extensions/system.rb', line 12

def call(component_dir)
  component_dir.each_component do |component|
    next unless register_component?(component)

    container.register(component.key, memoize: true) { component.instance.freeze }
  end
end