Class: ClassProfiler::Rack

Inherits:
Object show all
Defined in:
lib/class_profiler/rack.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Rack

Returns a new instance of Rack.



3
4
5
# File 'lib/class_profiler/rack.rb', line 3

def initialize(app)
  @app  = app
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/class_profiler/rack.rb', line 7

def call(env)
  response = ::ClassProfiler::Benchmark.instance.start 'rack time' do
    @status, @headers, @response = @app.call(env)
  end

  ::ClassProfiler::Benchmark.instance.report('rack time')
  return response
end