Class: Holidays::Finder::Context::ParseOptions

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

Instance Method Summary collapse

Constructor Details

#initialize(regions_repo, region_validator, definition_loader) ⇒ ParseOptions

Returns a new instance of ParseOptions.



5
6
7
8
9
# File 'lib/holidays/finder/context/parse_options.rb', line 5

def initialize(regions_repo, region_validator, definition_loader)
  @regions_repo = regions_repo
  @region_validator = region_validator
  @definition_loader = definition_loader
end

Instance Method Details

#call(*options) ⇒ Object

Returns [(arr)regions, (bool)observed, (bool)informal]



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/holidays/finder/context/parse_options.rb', line 12

def call(*options)
  options.flatten!

  #TODO This is garbage. These two deletes MUST come before the
  # parse_regions call, otherwise it thinks that :observed and :informal
  # are regions to parse. We should be splitting these things out.
  observed = options.delete(:observed) ? true : false
  informal = options.delete(:informal) ? true : false
  regions = parse_regions!(options)

  return regions, observed, informal
end