Sha256: c7f90cd97318658be10b1c73a0b94f103c7bdecaa6fef349ed9d083d6ce88b75
Contents?: true
Size: 714 Bytes
Versions: 6
Compression:
Stored size: 714 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 = Time.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