Skip to content

Instantly share code, notes, and snippets.

@markedmondson
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markedmondson/c73afcea32883b3ef516 to your computer and use it in GitHub Desktop.
Save markedmondson/c73afcea32883b3ef516 to your computer and use it in GitHub Desktop.
Level++ ++
state_counts = [
OpenStruct.new(name: "BC", country: "Canada", count: 5),
OpenStruct.new(name: "British Columbia", country: "CA", count: 65),
OpenStruct.new(name: "Ontario", country: "CA", count: 15),
OpenStruct.new(name: "QC", country: nil, count: 25),
OpenStruct.new(name: "Oregon", country: "USA", count: 35),
OpenStruct.new(name: "WA", country: "United States", count: 45),
OpenStruct.new(name: "CA", country: nil, count: 55),
OpenStruct.new(name: "WA", country: "Australia", count: 65)
]
# => {bc => 70, on => 15, qc => 25, or => 35, wa => 45, ca => 55, wtf => 65}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment