Module: Jets::Rails

Defined in:
lib/jets/rails.rb,
lib/jets/rails/railtie.rb,
lib/jets/rails/version.rb

Overview

Initializer interface

Examples:

set up a container with auto-registration paths

# config/initializer/system.rb

Dry::Rails.container do
  auto_register!("lib", "app/operations")
end

See Also:

  • Dry::Rails::Container.auto_register!

Defined Under Namespace

Classes: Railtie

Constant Summary collapse

VERSION =
"0.1.3"

Class Method Summary collapse

Class Method Details

._container_blocksObject

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/jets/rails.rb', line 51

def self._container_blocks
  @_container_blocks ||= []
end

.container(&block) ⇒ self

Set container block that will be evaluated in the context of the container

Returns:

  • (self)


25
26
27
28
# File 'lib/jets/rails.rb', line 25

def self.container(&block)
  _container_blocks << block
  self
end

.create_container(options = {}) ⇒ Class

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

Parameters:

  • options (Hash) (defaults to: {})

    Container configuration settings

Returns:

  • (Class)


39
40
41
# File 'lib/jets/rails.rb', line 39

def self.create_container(options = {})
  Class.new(Container) { config.update(options) }
end

.evaluate_initializer(container) ⇒ 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.



44
45
46
47
48
# File 'lib/jets/rails.rb', line 44

def self.evaluate_initializer(container)
  _container_blocks.each do |block|
    container.class_eval(&block)
  end
end