Class: Holidays::Definition::Validator::Region
- Inherits:
-
Object
- Object
- Holidays::Definition::Validator::Region
- Defined in:
- lib/holidays/definition/validator/region.rb
Instance Method Summary collapse
-
#initialize(regions_repo) ⇒ Region
constructor
A new instance of Region.
- #valid?(r) ⇒ Boolean
Constructor Details
#initialize(regions_repo) ⇒ Region
Returns a new instance of Region.
5 6 7 |
# File 'lib/holidays/definition/validator/region.rb', line 5 def initialize(regions_repo) @regions_repo = regions_repo end |
Instance Method Details
#valid?(r) ⇒ Boolean
9 10 11 12 13 14 15 16 17 |
# File 'lib/holidays/definition/validator/region.rb', line 9 def valid?(r) return false unless r.is_a?(Symbol) region = find_wildcard_base(r) (region == :any || @regions_repo.exists?(region) || region_in_static_definitions?(region)) end |