Class: Rack::Action

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env, profiler, middleware) ⇒ Action

Returns a new instance of Action.



240
241
242
243
244
245
246
# File 'lib/rack/contrib/perftools_profiler.rb', line 240

def initialize(env, profiler, middleware)
  @env = env
  @request = Request.new(env)
  @data_params = @request.params.clone
  @profiler = profiler
  @middleware = middleware
end

Class Method Details

.for_env(env, profiler, middleware) ⇒ Object



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/rack/contrib/perftools_profiler.rb', line 252

def self.for_env(env, profiler, middleware)
  request = Request.new(env)
  klass = 
    case request.path
    when '/__start__'
      StartProfiling
    when '/__stop__'
      StopProfiling
    when '/__data__'
      ReturnData
    else
      if ProfileOnce.has_special_param?(request)
        ProfileOnce
      else
        CallAppDirectly
      end
    end
  klass.new(env, profiler, middleware)
end

Instance Method Details

#actObject



248
249
250
# File 'lib/rack/contrib/perftools_profiler.rb', line 248

def act
  # do nothing
end