Sha256: bcde7ac4c44232d5cccbfe253332ef66b939e8a4b257ee60809b3302a273ed91

Contents?: true

Size: 520 Bytes

Versions: 1

Compression:

Stored size: 520 Bytes

Contents

# typed: strict
module Repeatable
  module Expression
    class DayInMonth < Date
      include LastDateOfMonth

      sig { params(day: Integer).void }
      def initialize(day:)
        @day = day
      end

      sig { override.params(date: ::Date).returns(T::Boolean) }
      def include?(date)
        if day < 0
          date - last_date_of_month(date) - 1 == day
        else
          date.day == day
        end
      end

      private

      sig { returns(Integer) }
      attr_reader :day
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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