Class: Rack::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/config.rb

Overview

Rack::Config modifies the environment using the block given during initialization.

Example:

use Rack::Config do |env|
  env['my-key'] = 'some-value'
end

Instance Method Summary collapse

Constructor Details

#initialize(app, &block) ⇒ Config

Returns a new instance of Config.



10
11
12
13
# File 'lib/rack/config.rb', line 10

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

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
# File 'lib/rack/config.rb', line 15

def call(env)
  @block.call(env)
  @app.call(env)
end