Class: Payload::RailsLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/payload/rails_loader.rb

Overview

Loads dependencies from config/dependencies.rb in Rails applications.

Used by Railtie to provide a Rails dependency loader to RackContainer.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.loadContainer

Load dependencies from outside a Rails request.

Examples:

RailsLoader.load[:example_service]

Returns:

  • (Container)

    dependencies from config/dependencies.rb



19
20
21
# File 'lib/payload/rails_loader.rb', line 19

def self.load
  new.load
end

.to_procObject

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.



11
12
13
# File 'lib/payload/rails_loader.rb', line 11

def self.to_proc
  lambda { load }
end

Instance Method Details

#loadObject

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
27
28
# File 'lib/payload/rails_loader.rb', line 24

def load
  namespace_containers.inject(root_container) do |target, source|
    target.import(source.exports)
  end
end