Sha256: e955b00f7e09ffd8d70b66ee7cb65f7f12ac4130e622f6deff5b72ee9f6c8457
Contents?: true
Size: 690 Bytes
Versions: 16
Compression:
Stored size: 690 Bytes
Contents
# frozen_string_literal: true module Montrose module Rule class DayOfYear include Montrose::Rule def self.apply_options(opts) opts[:yday] end # Initializes rule # # @param [Array<Fixnum>] days - valid days of year, e.g. [1, 2, -1] # def initialize(days) @days = days end def include?(time) @days.include?(time.yday) || included_from_end_of_month?(time) end private def included_from_end_of_month?(time) year_days = ::Montrose::Utils.days_in_year(time.year) # given by activesupport @days.any? { |d| year_days + d + 1 == time.yday } end end end end
Version data entries
16 entries across 16 versions & 1 rubygems