Class: Holidays::Definition::Context::Merger

Inherits:
Object
  • Object
show all
Defined in:
lib/holidays/definition/context/merger.rb

Overview

Merge a new set of definitions into the Holidays module.

This method is automatically called when including holiday definition files. This is accomplished because the Generator class generates the definition source with this class explicitly.

Instance Method Summary collapse

Constructor Details

#initialize(holidays_by_month_repo, regions_repo) ⇒ Merger

Returns a new instance of Merger.



10
11
12
13
# File 'lib/holidays/definition/context/merger.rb', line 10

def initialize(holidays_by_month_repo, regions_repo)
  @holidays_repo = holidays_by_month_repo
  @regions_repo = regions_repo
end

Instance Method Details

#call(target_regions, target_holidays) ⇒ Object



15
16
17
18
# File 'lib/holidays/definition/context/merger.rb', line 15

def call(target_regions, target_holidays)
  regions_repo.add(target_regions)
  holidays_repo.add(target_holidays)
end