class Dry::System::Importer
Default importer implementation
This is currently configured by default for every System::Container
. Importer
objects are responsible for importing components from one container to another. This is used in cases where an application is split into multiple sub-systems.
@api private
Attributes
container[R]
registry[R]
separator[R]
Public Class Methods
new(container)
click to toggle source
@api private
# File lib/dry/system/importer.rb, line 21 def initialize(container) @container = container @separator = container.config.namespace_separator @registry = {} end
Public Instance Methods
[](name)
click to toggle source
@api private
# File lib/dry/system/importer.rb, line 36 def [](name) registry.fetch(name) end
call(ns, other)
click to toggle source
@api private
# File lib/dry/system/importer.rb, line 46 def call(ns, other) container.merge(other, namespace: ns) end
finalize!()
click to toggle source
@api private
# File lib/dry/system/importer.rb, line 28 def finalize! registry.each do |name, container| call(name, container.finalize!) end self end
key?(name)
click to toggle source
@api private
# File lib/dry/system/importer.rb, line 41 def key?(name) registry.key?(name) end
register(other)
click to toggle source
@api private
# File lib/dry/system/importer.rb, line 51 def register(other) registry.update(other) end