Class: GouvCalendarCompilator::France::NationalDaysOffDataCompilator

Inherits:
Object
  • Object
show all
Defined in:
lib/gouv_calendar_compilator/data_compilators/france/national_days_off_data_compilator.rb

Overview

Data compiler class for national days off

Instance Method Summary collapse

Constructor Details

#initializeNationalDaysOffDataCompilator

Initializer for France National Days off Compiler class.



13
14
15
# File 'lib/gouv_calendar_compilator/data_compilators/france/national_days_off_data_compilator.rb', line 13

def initialize
  @data_fetcher = ::GouvCalendarCompilator::DataFetcher.new
end

Instance Method Details

#compile(calendar) ⇒ Object

This is the method you want to call to compile the sources into a proper dataset. It returns a ruby Array of Hashes

Parameters:

  • calendar

    Array<Hash> : previously formatted has of School holidays



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gouv_calendar_compilator/data_compilators/france/national_days_off_data_compilator.rb', line 21

def compile(calendar)
  @data_fetcher.fetch_national_days_off_data.each do |zone_specific_ndo_data|
    calendar = ndo_parse_data_region(
      zone_specific_ndo_data[:data],
      zone_specific_ndo_data[:zones],
      ::GouvCalendarCompilator::DataCompilator.sort_calendar_data(calendar)
    )
  end

  calendar
end