Class: Rack::Slowdown

Inherits:
Object
  • Object
show all
Defined in:
lib/rack-math/slowdown.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, delay = 4) ⇒ Slowdown



3
4
5
6
# File 'lib/rack-math/slowdown.rb', line 3

def initialize(app, delay = 4)
  @app = app
  @delay = delay
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
# File 'lib/rack-math/slowdown.rb', line 7

def call(env)
  status, headers, response = @app.call(env)
  sleep @delay
  [status, headers, response]  
end