Class: Holidays::Definition::Context::Merger
- Inherits:
-
Object
- Object
- Holidays::Definition::Context::Merger
- 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
- #call(target_regions, target_holidays, target_custom_methods) ⇒ Object
-
#initialize(holidays_by_month_repo, regions_repo, custom_methods_repo) ⇒ Merger
constructor
A new instance of Merger.
Constructor Details
#initialize(holidays_by_month_repo, regions_repo, custom_methods_repo) ⇒ Merger
Returns a new instance of Merger.
10 11 12 13 14 |
# File 'lib/holidays/definition/context/merger.rb', line 10 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
16 17 18 19 20 21 22 |
# File 'lib/holidays/definition/context/merger.rb', line 16 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 |