Sha256: af6ccfd15eae61279b7ced5e962c3f6fe4efae11a488d2b817e6d0114ad6f752

Contents?: true

Size: 595 Bytes

Versions: 1

Compression:

Stored size: 595 Bytes

Contents

# typed: strict
module Repeatable
  module Expression
    class Union < Set
      sig { params(elements: T.any(Expression::Base, T::Array[Expression::Base])).void }
      def initialize(*elements)
        other_unions, not_unions = elements.partition { |e| e.is_a?(self.class) }
        other_unions = T.cast(other_unions, T::Array[Expression::Union])
        super(other_unions.flat_map(&:elements).concat(not_unions))
      end

      sig { override.params(date: ::Date).returns(T::Boolean) }
      def include?(date)
        elements.any? { |e| e.include?(date) }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
repeatable-1.1.0 lib/repeatable/expression/union.rb