Skip to content

Instantly share code, notes, and snippets.

@thumblemonks
Created March 19, 2010 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save thumblemonks/338112 to your computer and use it in GitHub Desktop.
Save thumblemonks/338112 to your computer and use it in GitHub Desktop.
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