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