Sha256: 8691853a83deeeb443a2d38a6d0a49f5da922d0b75324699ccd4433834537572

Contents?: true

Size: 436 Bytes

Versions: 15

Compression:

Stored size: 436 Bytes

Contents

# frozen_string_literal: true

module Montrose
  module Rule
    class DayOfWeek
      include Montrose::Rule

      def self.apply_options(opts)
        opts[:day]
      end

      # Initializes rule
      #
      # @param [Array<Fixnum>] days - valid days of week, e.g. [1, 2, 7]
      #
      def initialize(days)
        @days = days
      end

      def include?(time)
        @days.include?(time.wday)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
montrose-0.17.0 lib/montrose/rule/day_of_week.rb
montrose-0.16.0 lib/montrose/rule/day_of_week.rb
montrose-0.15.0 lib/montrose/rule/day_of_week.rb
montrose-0.14.0 lib/montrose/rule/day_of_week.rb
montrose-0.13.0 lib/montrose/rule/day_of_week.rb
montrose-0.12.0 lib/montrose/rule/day_of_week.rb
montrose-0.11.2 lib/montrose/rule/day_of_week.rb
montrose-0.11.1 lib/montrose/rule/day_of_week.rb
montrose-0.11.0 lib/montrose/rule/day_of_week.rb
montrose-0.10.1 lib/montrose/rule/day_of_week.rb
montrose-0.10.0 lib/montrose/rule/day_of_week.rb
montrose-0.9.0 lib/montrose/rule/day_of_week.rb
montrose-0.8.2 lib/montrose/rule/day_of_week.rb
montrose-0.8.1 lib/montrose/rule/day_of_week.rb
montrose-0.8.0 lib/montrose/rule/day_of_week.rb