ctcherry (owner)

Revisions

gist: 210619 Download_button fork
public
Public Clone URL: git://gist.github.com/210619.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module Rack
  class Roll
    
    def initialize(app)
      @app = app
    end
    
    def call(env)
      if roll?
        return [302, {'Location' => 'http://www.youtube.com/watch?v=oHg5SJYRHA0'}, ["You've been rick rolled"]]
      else
        return [404, {}, ['']]
      end
    end
    
    private
    
      def roll?
        (rand(10) == 4)
      end
    
  end
end