Module: Dry::System::Rails
- Defined in:
- lib/dry/system/rails.rb,
lib/dry/system/rails/railtie.rb,
lib/dry/system/rails/version.rb,
lib/dry/system/rails/container.rb
Overview
Initializer interface
Defined Under Namespace
Constant Summary collapse
- VERSION =
'0.3.1'
Class Method Summary collapse
-
.container(&block) ⇒ Object
Set container block that will be evaluated in the context of the container.
- .container_block ⇒ Object private
-
.create_container(options = {}) ⇒ Object
private
Create a new container class.
Class Method Details
.container(&block) ⇒ Object
Set container block that will be evaluated in the context of the container
24 25 26 27 |
# File 'lib/dry/system/rails.rb', line 24 def self.container(&block) @container_block = block self end |
.container_block ⇒ 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.
51 52 53 |
# File 'lib/dry/system/rails.rb', line 51 def self.container_block defined?(@container_block) && @container_block end |
.create_container(options = {}) ⇒ 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.
Create a new container class
This is used during booting and reloading
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/dry/system/rails.rb', line 34 def self.create_container( = {}) container = Class.new(Container) container.class_eval(&@container_block) if container_block = { root: ::Rails.root, system_dir: ::Rails.root.join('config/system'), } container.config.update(.merge()) container.load_paths!('lib', 'app', 'app/models') container end |