Class: Dry::Rails::Container
- Inherits:
-
System::Container
- Object
- System::Container
- Dry::Rails::Container
- Defined in:
- lib/dry/rails/container.rb
Overview
Customized Container class for Rails applications
Configuration collapse
-
.config.auto_inject_constant=(auto_inject_constant) ⇒ Object
Set a custom import constant name.
-
.config.container_constant=(container_constant) ⇒ Object
Set a custom container constant.
-
.config.features=(features) ⇒ Object
Set an array of features that should be enabled by default.
Class Method Summary collapse
-
.refresh_provider_files ⇒ self
private
This is called when reloading in dev mode.
-
.started?(name) ⇒ Boolean
private
Return if a given component was started.
Instance Method Summary collapse
- #require_path(path) ⇒ Object private
Class Method Details
.config.auto_inject_constant=(auto_inject_constant) ⇒ Object
39 40 41 |
# File 'lib/dry/rails/container.rb', line 39 setting :auto_inject_constant, default: "Deps", reader: true |
.config.container_constant=(container_constant) ⇒ Object
50 51 52 |
# File 'lib/dry/rails/container.rb', line 50 setting :container_constant, default: "Container", reader: true |
.config.features=(features) ⇒ Object
28 29 30 |
# File 'lib/dry/rails/container.rb', line 28 setting :features, default: %i[application_contract safe_params controller_helpers], reader: true |
.refresh_provider_files ⇒ self
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.
This is called when reloading in dev mode
82 83 84 85 86 87 |
# File 'lib/dry/rails/container.rb', line 82 def refresh_provider_files providers.provider_files.each do |boot_file| ::Kernel.load(boot_file) end self end |
.started?(name) ⇒ Boolean
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.
Return if a given component was started
65 66 67 |
# File 'lib/dry/rails/container.rb', line 65 def started?(name) providers[name].started? end |
Instance Method Details
#require_path(path) ⇒ 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.
72 73 74 |
# File 'lib/dry/rails/container.rb', line 72 def require_path(path) require_dependency(path) end |