Class: Payload::RackContainer Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Uses a dependency loader to load dependencies and inject them into the Rack environment.

Accepts a Rack application and a block for loading dependencies as a Container. The container will be injected into each Rack request as :dependencies in the Rack environment.

Used internally by Railtie.

Instance Method Summary collapse

Constructor Details

#initialize(app, &loader) ⇒ RackContainer

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.

Returns a new instance of RackContainer.



13
14
15
16
# File 'lib/payload/rack_container.rb', line 13

def initialize(app, &loader)
  @app = app
  @loader = loader
end

Instance Method Details

#call(env) ⇒ 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.



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

def call(env)
  env[:dependencies] = @loader.call.service(:rack_env) { |container| env }
  @app.call(env)
end