Module: Dry::System
- Includes:
- Core::Constants
- Defined in:
- lib/dry/system.rb,
lib/dry/system/stubs.rb,
lib/dry/system/booter.rb,
lib/dry/system/errors.rb,
lib/dry/system/loader.rb,
lib/dry/system/plugins.rb,
lib/dry/system/version.rb,
lib/dry/system/importer.rb,
lib/dry/system/provider.rb,
lib/dry/system/settings.rb,
lib/dry/system/component.rb,
lib/dry/system/constants.rb,
lib/dry/system/container.rb,
lib/dry/system/lifecycle.rb,
lib/dry/system/plugins/env.rb,
lib/dry/system/auto_registrar.rb,
lib/dry/system/plugins/logging.rb,
lib/dry/system/manual_registrar.rb,
lib/dry/system/plugins/bootsnap.rb,
lib/dry/system/components/config.rb,
lib/dry/system/provider_registry.rb,
lib/dry/system/plugins/monitoring.rb,
lib/dry/system/components/bootable.rb,
lib/dry/system/settings/file_loader.rb,
lib/dry/system/settings/file_parser.rb,
lib/dry/system/magic_comments_parser.rb,
lib/dry/system/plugins/notifications.rb,
lib/dry/system/plugins/monitoring/proxy.rb,
lib/dry/system/booter/component_registry.rb,
lib/dry/system/auto_registrar/configuration.rb
Defined Under Namespace
Modules: Components, Plugins, Settings Classes: AutoRegistrar, Booter, Component, Container, Importer, Lifecycle, Loader, MagicCommentsParser, ManualRegistrar, Provider, ProviderRegistry
Constant Summary collapse
- FileNotFoundError =
Error raised when the container tries to load a component with missing file
Class.new(StandardError) do def initialize(component) super("could not resolve require file for #{component.identifier}") end end
- ComponentFileMismatchError =
Error raised when booter file do not match with register component
Class.new(StandardError) do def initialize(component) super("Boot file for component #{component.identifier.inspect} not found. Container boot files under #{component.boot_path}: #{component.container_boot_files.inspect}") end end
- ComponentLoadError =
Error raised when a resolved component couldn’t be found
Class.new(StandardError) do def initialize(component) super("could not load component #{component.inspect}") end end
- InvalidComponentError =
Error raised when resolved component couldn’t be loaded
Class.new(ArgumentError) do def initialize(name, reason = nil) super( "Tried to create an invalid #{name.inspect} component - #{reason}" ) end end
- InvalidComponentIdentifierError =
Error raised when component’s identifier is not valid
Class.new(ArgumentError) do def initialize(name) super( "component identifier +#{name}+ is invalid or boot file is missing" ) end end
- InvalidComponentIdentifierTypeError =
Error raised when component’s identifier for booting is not a symbol
Class.new(ArgumentError) do def initialize(name) super("component identifier #{name.inspect} must be a symbol") end end
- ComponentNotStartedError =
Error raised when trying to stop a component that hasn’t started yet
Class.new(StandardError) do def initialize(component_name) super("component +#{component_name}+ has not been started") end end
- VERSION =
'0.11.0'.freeze
- RB_EXT =
'.rb'.freeze
- RB_GLOB =
'*.rb'.freeze
- PATH_SEPARATOR =
'/'.freeze
- DEFAULT_SEPARATOR =
'.'.freeze
- WORD_REGEX =
/\w+/.freeze
- DuplicatedComponentKeyError =
Class.new(ArgumentError)
- InvalidSettingsError =
Class.new(ArgumentError) do # @api private def initialize(attributes) = <<~EOF Could not initialize settings. The following settings were invalid: #{attributes_errors(attributes).join("\n")} EOF super() end private def attributes_errors(attributes) attributes.map { |key, error| "#{key.name}: #{error}" } end end
- PluginDependencyMissing =
Exception raise when a plugin dependency failed to load
Class.new(StandardError) do # @api private def initialize(plugin, ) super("dry-system plugin #{plugin.inspect} failed to load its dependencies: #{}") end end
Class Method Summary collapse
- .providers ⇒ Object private
-
.register_component(identifier, provider:, &block) ⇒ Object
Register an external component that can be booted within other systems.
-
.register_provider(identifier, options) ⇒ Object
Register external component provider.
Class Method Details
.providers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/dry/system.rb', line 24 def self.providers @__providers__ ||= ProviderRegistry.new end |
.register_component(identifier, provider:, &block) ⇒ Object
Register an external component that can be booted within other systems
18 19 20 21 |
# File 'lib/dry/system.rb', line 18 def self.register_component(identifier, provider:, &block) providers[provider].register_component(identifier, block) self end |
.register_provider(identifier, options) ⇒ Object
Register external component provider
9 10 11 12 13 |
# File 'lib/dry/system.rb', line 9 def self.register_provider(identifier, ) providers.register(identifier, ) providers[identifier].load_components self end |