Created
March 19, 2010 20:02
-
-
Save thumblemonks/338112 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
require 'pp' | |
votes = { | |
"gus" => ["Colonel Panic", "Cigar Heroes"], | |
"shinji" => ["Bomb Squad","Taco Town"], | |
"nawara" => ["Colonel Panic", "Taco Town", "Danger!! Death Ray"], | |
"richie" => ["Bomb Squad", "Death Ray", "Bomb Ray Death Squad"], | |
"colin" => ["Colonel Panic", "Taco Town"], | |
"joey" => ["Danger!! Death Ray", "Bomb Squad"] | |
} | |
# In a tie, Shinji rules them all | |
pp votes.values.flatten.inject(Hash.new(0)) {|counter, name| counter[name] += 1; counter } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment