Created
August 15, 2010 07:39
-
-
Save georgeredinger/525219 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def the_winner_is(env) | |
candidates_list = env["QUERY_STRING"].to_s.split(",") | |
winner=candidates_list[rand(candidates_list.size)] | |
page = <<-TEXT | |
<h3>Usage: http://picklejar-rack.heroku.com?name,name,name...,name</h1> <br> | |
<h1>The Winner is: #{winner}</h1> | |
Chosen at random from <br> | |
<ol> | |
TEXT | |
candidates_list.each {|c| page += "<li> #{c} </li>"} | |
page += "</ol>" | |
TEXT | |
[200, {'Content-Type'=>'text/html'}, page] | |
end | |
run method(:the_winner_is) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment