Class: Usher::Interface::Rack::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/usher/interface/rack/middleware.rb

Overview

Middleware for using Usher’s rack interface to recognize the request, then, pass on to the next application. Values are stored in env normally. The details of that storage is in the Rack interface itself.

Instance Method Summary collapse

Constructor Details

#initialize(app, router) ⇒ Middleware

Returns a new instance of Middleware.

Parameters:

  • app (#call)

    Application to call next

  • router (Usher::Interface::Rack)

    The router call first before calling the next application



11
12
13
14
# File 'lib/usher/interface/rack/middleware.rb', line 11

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

Instance Method Details

#call(env) ⇒ #each

Returns The application’s return.

Parameters:

  • env (Hash)

    The environment hash

Returns:

  • (#each)

    The application’s return



18
19
20
21
# File 'lib/usher/interface/rack/middleware.rb', line 18

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