class Roger::Rack::Sleep
Listens to the “sleep” parameter and sleeps the amount of seconds specified by the parameter. There is however a maximum of 5 seconds.
Public Class Methods
new(app)
click to toggle source
# File lib/roger/rack/sleep.rb, line 6 def initialize(app) @app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/roger/rack/sleep.rb, line 10 def call(env) r = ::Rack::Request.new(env) if r.params["sleep"] sleeptime = [r.params["sleep"].to_i, 5].min sleep sleeptime end @app.call(env) end