Class: Rack::Header::Context

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

Instance Method Summary collapse

Constructor Details

#initialize(app, headers = {}) ⇒ Context

Returns a new instance of Context.



3
4
5
# File 'lib/rack/header/context.rb', line 3

def initialize(app, headers = {})
  @app, @headers = app, headers
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/rack/header/context.rb', line 7

def call(env)
  status, headers, response = @app.call(env)
  @headers.each do |k,v|
    headers[k] = v
  end
  headers.delete_if { |k,v| v.nil? }
  
  [status, headers, response]
end