Class: Dry::System::Rails::Container

Inherits:
System::Container
  • Object
show all
Defined in:
lib/dry/system/rails/container.rb

Overview

Customized Container class for Rails application

Class Method Summary collapse

Class Method Details

.auto_register!(dir, &block) ⇒ Object

Auto register files from the provided directory



18
19
20
21
22
23
24
25
26
# File 'lib/dry/system/rails/container.rb', line 18

def auto_register!(dir, &block)
  if block
    config.auto_register_configs << [dir, block]
  else
    config.auto_register << dir
  end

  self
end

.finalize!(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.



29
30
31
32
33
34
# File 'lib/dry/system/rails/container.rb', line 29

def finalize!(options = {})
  config.auto_register_configs.each do |(dir, block)|
    auto_registrar.call(dir, &block)
  end
  super
end

.refresh_boot_filesObject

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



46
47
48
49
50
51
# File 'lib/dry/system/rails/container.rb', line 46

def refresh_boot_files
  booter.boot_files.each do |boot_file|
    load(boot_file)
  end
  self
end

.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.

Use ‘require_dependency` to make code reloading work



39
40
41
# File 'lib/dry/system/rails/container.rb', line 39

def require_path(path)
  require_dependency(path)
end