Skip to content

Instantly share code, notes, and snippets.

@sobbybutter
Created April 7, 2015 20:25
Show Gist options
  • Save sobbybutter/4f51d20b83bbe9a73b99 to your computer and use it in GitHub Desktop.
Save sobbybutter/4f51d20b83bbe9a73b99 to your computer and use it in GitHub Desktop.
long_list = [["a", "0000"], ["b", "12345"], ["c", "6789"]]
short_list = ["b", "c"]
long_list.each_with_object([]) do |item,array|
if short_list.include?(item[0])
array << item[1]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment