Skip to content

Instantly share code, notes, and snippets.

@dkhmelenko
Last active March 12, 2021 15:51
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 dkhmelenko/3143ce68e6cdb51d68eec237a8aec8fc to your computer and use it in GitHub Desktop.
Save dkhmelenko/3143ce68e6cdb51d68eec237a8aec8fc to your computer and use it in GitHub Desktop.
city_companies = {
apple: ["Boston", "Seattle", "San Francisco"],
uniliver: ["London", "Sussex"],
microsoft: ["Seattle", "Austin", "Denver"],
amazon: ["Portland", "Denver", "Washington"],
starbucks: ["Beijing", "Seattle", "Munich"]
}
tech_giants = [:apple, :microsoft, :amazon]
tech_giants_cities = city_companies
.select {|company, cities| tech_giants.include?(company)}
.map {|company, cities| cities}
.flatten
.uniq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment