Sha256: e5d6af7c178e4bcfbf56f5cc0728528580246523059c3ff8c5dc4388a1bd87ae

Contents?: true

Size: 472 Bytes

Versions: 7

Compression:

Stored size: 472 Bytes

Contents

module Montrose
  module Rule
    class TimeOfDay
      include Montrose::Rule

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

      # Initializes rule
      #
      # @param [Array<Time>] times - valid hours of days
      #
      def initialize(times)
        @times = times
      end

      def include?(time)
        @times.include?(parts(time))
      end

      private

      def parts(time)
        [time.hour, time.min]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
montrose-0.6.0 lib/montrose/rule/time_of_day.rb
montrose-0.5.0 lib/montrose/rule/time_of_day.rb
montrose-0.4.3 lib/montrose/rule/time_of_day.rb
montrose-0.4.2 lib/montrose/rule/time_of_day.rb
montrose-0.4.1 lib/montrose/rule/time_of_day.rb
montrose-0.4.0 lib/montrose/rule/time_of_day.rb
montrose-0.3.0 lib/montrose/rule/time_of_day.rb