Given the following code (where I display some statistics about a number of bookings):
statistics = [["Germany", "EUR"], 23], [["Germany", "USD"], 42], [["Spain", "EUR"], 17]
statistics.each do |country_and_currency, number_of_bookings|
country, currency = country_and_currency # <-- Ugly.
puts "There are #{number_of_bookings} in #{currency} in #{country}"
end
The country_and_currency part is quite ugly. I tried ... do |*(country, currency), number_of_bookings|, but this did not work.
Is there an elegant way to process this nested array without using the country_and_currency variable?