Class: Holidays::Finder::Context::DatesDriverBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/holidays/finder/context/dates_driver_builder.rb

Instance Method Summary collapse

Instance Method Details

#call(start_date, end_date) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/holidays/finder/context/dates_driver_builder.rb', line 11

def call(start_date, end_date)
  dates_driver = {}

  (start_date..end_date).each do |date|
    dates_driver[date.year] = [] unless dates_driver[date.year]
    dates_driver[date.year] << date.month
    dates_driver = add_border_months(date, dates_driver)
  end
  clean(dates_driver)
end