Sha256: 995463e7b6bdc070533d780ba0216b93abdf94c60390e5729b14aa9b35a38177

Contents?: true

Size: 948 Bytes

Versions: 1

Compression:

Stored size: 948 Bytes

Contents

# typed: strict
module Repeatable
  module Expression
    class Difference < Base
      sig { params(included: Expression::Base, excluded: Expression::Base).void }
      def initialize(included:, excluded:)
        @included = included
        @excluded = excluded
      end

      sig { override.params(date: ::Date).returns(T::Boolean) }
      def include?(date)
        included.include?(date) && !excluded.include?(date)
      end

      sig { params(other: Object).returns(T::Boolean) }
      def ==(other)
        other.is_a?(self.class) &&
          included == other.included &&
          excluded == other.excluded
      end

      protected

      sig { returns(Expression::Base) }
      attr_reader :included

      sig { returns(Expression::Base) }
      attr_reader :excluded

      sig { override.returns(Types::SymbolHash) }
      def hash_value
        {included: included.to_h, excluded: excluded.to_h}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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