Skip to content

Instantly share code, notes, and snippets.

@richievos
Forked from thumblemonks/team-votes.rb
Created March 23, 2010 00:26
Show Gist options
  • Save richievos/340722 to your computer and use it in GitHub Desktop.
Save richievos/340722 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"],
"dodos" => [],
"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