If you have an array of ranges, for example [1..4, 7..11, 14..18, 21..25, 28..28] , what parameters do I have for iterating through the elements?
I could do
ranges.each do |range| range.each do |date| puts "Do work on February #{date}" end end
which is a little detailed, or I could do
dates = ranges.map(&:to_a).flatten dates.each do |date| puts "Do work on February #{date}" end
which can use large memory if the ranges are large.
Are there any alternatives?
source share