Class: Alf::Rest::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/alf/rest/middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, config) ⇒ Middleware

Returns a new instance of Middleware.



5
6
7
8
# File 'lib/alf/rest/middleware.rb', line 5

def initialize(app, config)
  @app    = app
  @config = config
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
# File 'lib/alf/rest/middleware.rb', line 10

def call(env)
  env[Rest::RACK_CONFIG_KEY] = cfg = @config.dup
  cfg.connect do
    @app.call(env)
  end
end