Skip to content

Instantly share code, notes, and snippets.

@jm
Created March 25, 2009 00:11
Show Gist options
  • Save jm/84447 to your computer and use it in GitHub Desktop.
Save jm/84447 to your computer and use it in GitHub Desktop.
tags = ["one", "two", "three", "one", "two", "one"]
counts = Hash.new(0)
tags.each {|t| counts[t] += 1}
puts counts.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment