Skip to content

Instantly share code, notes, and snippets.

@havenwood
Created March 23, 2020 22:22
rows = data.map do |country|
[country.values_at('country', 'cases', 'deaths', 'recovered')]
end
# then extract a constant
COUNTRY_OUTCOMES = ['country', *CASES_DEATHS_RECOVERED].freeze
rows = data.map do |country|
[country.values_at(*COUNTRY_OUTCOMES)]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment