Class: Repeatable::Expression::Intersection
- Inherits:
-
Set
- Object
- Base
- Set
- Repeatable::Expression::Intersection
show all
- Defined in:
- lib/repeatable/expression/intersection.rb
Instance Attribute Summary
Attributes inherited from Set
#elements
Instance Method Summary
collapse
Methods inherited from Set
#<<, #==
Methods inherited from Base
===, #deconstruct_keys, #difference, #intersection, #to_h, #union
Constructor Details
#initialize(*elements) ⇒ void
7
8
9
10
11
12
|
# File 'lib/repeatable/expression/intersection.rb', line 7
def initialize(*elements)
elements = Array(elements).flatten
other_intersections, not_intersections = elements.partition { |e| e.is_a?(self.class) }
other_intersections = T.cast(other_intersections, T::Array[Expression::Intersection])
super(other_intersections.flat_map(&:elements).concat(not_intersections))
end
|
Instance Method Details
#include?(date) ⇒ Boolean
15
16
17
|
# File 'lib/repeatable/expression/intersection.rb', line 15
def include?(date)
elements.all? { |e| e.include?(date) }
end
|