Sha256: 81c11ec006cae34ba47f56574023b28d6ff0576e625ab0caf8581a0c0f5c6633

Contents?: true

Size: 442 Bytes

Versions: 16

Compression:

Stored size: 442 Bytes

Contents

# frozen_string_literal: true

module Montrose
  module Rule
    class HourOfDay
      include Montrose::Rule

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

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

      def include?(time)
        @hours.include?(time.hour)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

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