lib/repeatable/expression/union.rb in repeatable-0.6.0 vs lib/repeatable/expression/union.rb in repeatable-1.0.0
- old
+ new
@@ -1,7 +1,12 @@
module Repeatable
module Expression
class Union < Set
+ def initialize(*elements)
+ other_unions, not_unions = elements.partition { |e| e.is_a?(self.class) }
+ super(other_unions.flat_map(&:elements) + not_unions)
+ end
+
def include?(date)
elements.any? { |e| e.include?(date) }
end
end
end