class OptimusPrime::Wait

Public Class Methods

new(app) click to toggle source
# File lib/optimus_prime.rb, line 37
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/optimus_prime.rb, line 41
def call(env)

  if match = env["PATH_INFO"].match(/\/wait\/(\d+)/)
    ttw = match.string.split("/").last.to_i
    sleep(ttw)
    return [200, {}, ["Inactive for: #{ttw}"]]
  end

  @app.call(env)
end