Class: RackProf

Inherits:
Object
  • Object
show all
Defined in:
lib/rack_prof.rb,
lib/rack_prof/version.rb

Constant Summary collapse

DEFAULT_PRINTER =
RubyProf::CallStackPrinter
PRINTERS =
{
  RubyProf::FlatPrinter      => 'flat.txt',
  RubyProf::GraphPrinter     => 'graph.txt',
  RubyProf::GraphHtmlPrinter => 'graph.html',
  RubyProf::CallStackPrinter => 'call_stack.html',
  RubyProf::CallTreePrinter  => 'call_tree.tree'
}
VERSION =
"0.1.1"

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ RackProf

Returns a new instance of RackProf.



16
17
18
# File 'lib/rack_prof.rb', line 16

def initialize(app, options = {})
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/rack_prof.rb', line 20

def call(env)
  request = Rack::Request.new(env)
  if request.params.delete('profile')
    profile(env, request)
  else
    @app.call(env)
  end
end