class Dry::System::Provider
Attributes
components[R]
identifier[R]
options[R]
Public Class Methods
new(identifier, options)
click to toggle source
# File lib/dry/system/provider.rb, line 16 def initialize(identifier, options) @identifier = identifier @options = options @components = Concurrent::Map.new end
Public Instance Methods
boot_file(name)
click to toggle source
# File lib/dry/system/provider.rb, line 34 def boot_file(name) boot_files.detect { |path| Pathname(path).basename(RB_EXT).to_s == name.to_s } end
boot_files()
click to toggle source
# File lib/dry/system/provider.rb, line 26 def boot_files ::Dir[boot_path.join("**/#{RB_GLOB}")].sort end
boot_path()
click to toggle source
# File lib/dry/system/provider.rb, line 22 def boot_path options.fetch(:boot_path) end
component(name, options = {})
click to toggle source
# File lib/dry/system/provider.rb, line 38 def component(name, options = {}) identifier = options[:key] || name components.fetch(identifier).new(name, options) end
load_components()
click to toggle source
# File lib/dry/system/provider.rb, line 43 def load_components boot_files.each { |f| Kernel.require f } freeze self end
register_component(name, fn)
click to toggle source
# File lib/dry/system/provider.rb, line 30 def register_component(name, fn) components[name] = Components::Bootable.new(name, &fn) end