class Dry::System::Provider

Attributes

components[R]
name[R]
options[R]

Public Class Methods

new(name, options) click to toggle source
# File lib/dry/system/provider.rb, line 16
def initialize(name, options)
  @name = name
  @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(component_name, options = {}) click to toggle source
# File lib/dry/system/provider.rb, line 38
def component(component_name, options = {})
  component_key = options[:key] || component_name
  components.fetch(component_key).new(component_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