Class: Rack::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/contrib/perftools_profiler.rb

Constant Summary collapse

DEFAULT_PRINTER =
:text
PRINTER_CONTENT_TYPE =
{
  :text => 'text/plain',
  :gif => 'image/gif',
  :pdf => 'application/pdf'
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, profiler) ⇒ Action

Returns a new instance of Action.



50
51
52
53
# File 'lib/rack/contrib/perftools_profiler.rb', line 50

def initialize(request, profiler)
  @request = request
  @profiler = profiler
end

Class Method Details

.for_request(request, profiler) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/rack/contrib/perftools_profiler.rb', line 55

def self.for_request(request, profiler)
  return ProfileOnce.new(request, profiler) if ProfileOnce.has_special_param?(request)
  case request.path
  when '/__start__'
    StartProfiling.new(request, profiler)
  when '/__stop__'
    StopProfiling.new(request, profiler)
  when '/__data__'
    ReturnData.new(request, profiler)
  else
    CallAppDirectly.new(request, profiler)
  end
end