Class: Autotuner::RackPlugin

Inherits:
Object
  • Object
show all
Defined in:
lib/autotuner/rack_plugin.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ RackPlugin

Returns a new instance of RackPlugin.



5
6
7
8
# File 'lib/autotuner/rack_plugin.rb', line 5

def initialize(app)
  @app = app
  @request_collector = RequestCollector.new
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/autotuner/rack_plugin.rb', line 10

def call(env)
  if Autotuner.enabled?
    @request_collector.request do
      @app.call(env)
    end
  else
    @app.call(env)
  end
end