Class: Holidays::Finder::Rules::InRegion
- Inherits:
-
Object
- Object
- Holidays::Finder::Rules::InRegion
- Defined in:
- lib/holidays/finder/rules/in_region.rb
Class Method Summary collapse
Class Method Details
.call(requested, available) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/holidays/finder/rules/in_region.rb', line 6 def call(requested, available) return true if requested.include?(:any) # When an underscore is encountered, derive the parent regions # symbol and check for both. requested = requested.collect do |r| r.to_s =~ /_/ ? [r, r.to_s.gsub(/_[\w]*$/, '').to_sym] : r end requested = requested.flatten.uniq available.any? { |avail| requested.include?(avail) } end |