Sha256: fed35701bbd3e8fb290377840cce69fef983f66f6b73062e3d11e2619e709456
Contents?: true
Size: 727 Bytes
Versions: 6
Compression:
Stored size: 727 Bytes
Contents
module Montrose module Rule class DayOfMonth include Montrose::Rule def self.apply_options(opts) opts[:mday] end # Initializes rule # # @param [Array<Fixnum>] days - valid days of month, i.e. [1, 2, -1] # def initialize(days) @days = days end def include?(time) @days.include?(time.mday) || included_from_end_of_month?(time) end private # matches days specified at negative numbers def included_from_end_of_month?(time) month_days = ::Montrose::Utils.days_in_month(time.month, time.year) # given by activesupport @days.any? { |d| month_days + d + 1 == time.mday } end end end end
Version data entries
6 entries across 6 versions & 1 rubygems