Class: Promenade::YJIT::Middlware

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

Constant Summary collapse

RACK_AFTER_REPLY =
"rack.after_reply".freeze

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middlware

Returns a new instance of Middlware.



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

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



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

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