Class: Promenade::Raindrops::Middleware

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

Constant Summary collapse

RACK_AFTER_REPLY =
"rack.after_reply".freeze

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



8
9
10
# File 'lib/promenade/raindrops/middleware.rb', line 8

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
# File 'lib/promenade/raindrops/middleware.rb', line 12

def call(env)
  if env.key?(RACK_AFTER_REPLY)
    env[RACK_AFTER_REPLY] << -> { instrument }
  end
  @app.call(env)
end