Module: DayOffs::Sources::DSL

Included in:
Base
Defined in:
lib/day_offs/sources/dsl.rb

Instance Method Summary collapse

Instance Method Details

#with_countries(*countries_alpha2) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/day_offs/sources/dsl.rb', line 5

def with_countries(*countries_alpha2)
  verified_countries = countries_alpha2.map do |country|
    DayOffs::Sources::Validator.validate_country(country.upcase)
    country.upcase
  end

  self.countries = countries + verified_countries
end

#with_name(source_name) ⇒ Object



14
15
16
# File 'lib/day_offs/sources/dsl.rb', line 14

def with_name(source_name)
  self.source_name = source_name
end

#with_years(*years) ⇒ Object



18
19
20
21
# File 'lib/day_offs/sources/dsl.rb', line 18

def with_years(*years)
  years.each { |year| DayOffs::Sources::Validator.validate_year(year.to_s) }
  self.years = self.years + years
end