Class: Makara::Middleware

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

Instance Method Summary collapse

Constructor Details

#initialize(app, cookie_options = {}) ⇒ Middleware

Returns a new instance of Middleware.



6
7
8
9
# File 'lib/makara/middleware.rb', line 6

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

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/makara/middleware.rb', line 11

def call(env)
  return @app.call(env) if ignore_request?(env)

  set_current_context(env)

  status, headers, body = @app.call(env)
  store_new_context(headers)

  [status, headers, body]
end