Class: Rack::Current::Middleware
- Inherits:
-
Object
- Object
- Rack::Current::Middleware
- Includes:
- Rack::Current
- Defined in:
- lib/rack-current/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
7 8 9 |
# File 'lib/rack-current/middleware.rb', line 7 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/rack-current/middleware.rb', line 11 def call(env) before = self.current_request self.current_request = Rack::Request.new(env) @app.call(env) ensure self.current_request = before end |