Skip to content

Instantly share code, notes, and snippets.

@markedmondson
Last active August 29, 2015 14:01
Show Gist options
  • Save markedmondson/75ace94346e7daf88d60 to your computer and use it in GitHub Desktop.
Save markedmondson/75ace94346e7daf88d60 to your computer and use it in GitHub Desktop.
Level++
state_counts = [
OpenStruct.new(name: "BC", country: "Canada", count: 5),
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)
]
canada = OpenStruct.new(name: "Canada", iso: "CA", iso3: "CAN")
usa = OpenStruct.new(name: "United States", iso: "US", iso3: "USA")
australia = OpenStruct.new(name: "Australia", iso: "AU", iso3: "AUS")
# => {bc => 5, on => 15, qc => 25, or => 35, wa => 45, ca => 55, wtf=> 65}
@markedmondson
Copy link
Author

Yeah it was more to ensure that "WA" wasn't being used as a state matcher for Washington.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment