class RickrollingRoulette::ResponseRedirect

Public Class Methods

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

Public Instance Methods

call(env) click to toggle source
# File lib/rickrolling_roulette.rb, line 12
def call(env)
  status, headers, response = @app.call(env)

  num = rand(2)
  if num == 1
    [302, {"Location" => "http://www.youtube.com/watch?v=oHg5SJYRHA0"}, response]
  else
    [status, headers, response]
  end
end