Skip to content

Commit

Permalink
Update AutoRegistrar to fit with dry-system 0.19
Browse files Browse the repository at this point in the history
  • Loading branch information
timriley committed May 24, 2021
1 parent 7dddae1 commit ae06f59
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/dry/effects/extensions/system.rb
Expand Up @@ -8,11 +8,12 @@ module Dry
module Effects
module System
class AutoRegistrar < ::Dry::System::AutoRegistrar
def call(dir)
super do |config|
config.memoize = true
config.instance { |c| c.instance.freeze }
yield(config) if block_given?
# Always memoize and freeze registered components
def call(component_dir)
components(component_dir).each do |component|
next unless register_component?(component)

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

0 comments on commit ae06f59

Please sign in to comment.