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.

Instance Method Summary collapse

Constructor Details

#initialize(holidays_by_month_repo, regions_repo, custom_methods_repo) ⇒ Merger

Returns a new instance of Merger.



6
7
8
9
10
# File 'lib/holidays/definition/context/merger.rb', line 6

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

Instance Method Details

#call(target_regions, target_holidays, target_custom_methods) ⇒ Object



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

def call(target_regions, target_holidays, target_custom_methods)
  #FIXME Does this need to come in this exact order? God I hope not.
  # If not then we should swap the order so it matches the init.
  @regions_repo.add(target_regions)
  @holidays_repo.add(target_holidays)
  @custom_methods_repo.add(target_custom_methods)
end