Class: Repeatable::Expression::Intersection
- Defined in:
- lib/repeatable/expression/intersection.rb
Instance Attribute Summary
Attributes inherited from Set
Instance Method Summary collapse
- #include?(date) ⇒ Boolean
-
#initialize(*elements) ⇒ Intersection
constructor
A new instance of Intersection.
Methods inherited from Set
Methods inherited from Base
===, #difference, #intersection, #to_h, #union
Constructor Details
#initialize(*elements) ⇒ Intersection
Returns a new instance of Intersection.
4 5 6 7 |
# File 'lib/repeatable/expression/intersection.rb', line 4 def initialize(*elements) other_intersection, not_intersection = elements.partition { |e| e.is_a?(self.class) } super(other_intersection.flat_map(&:elements) + not_intersection) end |
Instance Method Details
#include?(date) ⇒ Boolean
9 10 11 |
# File 'lib/repeatable/expression/intersection.rb', line 9 def include?(date) elements.all? { |e| e.include?(date) } end |