Sha256: cd4a69086065937469ce51451d7286ad4a3c65e99a3ee5b1c92f0e0cdfbdba2f

Contents?: true

Size: 515 Bytes

Versions: 7

Compression:

Stored size: 515 Bytes

Contents

# frozen_string_literal: true

module Montrose
  module Rule
    class Between
      include Montrose::Rule

      def self.apply_options(opts)
        opts[:between].is_a?(Range) && opts[:between]
      end

      # Initializes rule
      #
      # @param [Range] between - timestamp range
      #
      def initialize(between)
        @between = between
      end

      def include?(time)
        @between.cover?(time)
      end

      def continue?(time)
        time < @between.max
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
montrose-0.18.0 lib/montrose/rule/between.rb
montrose-0.17.0 lib/montrose/rule/between.rb
montrose-0.16.0 lib/montrose/rule/between.rb
montrose-0.15.0 lib/montrose/rule/between.rb
montrose-0.14.0 lib/montrose/rule/between.rb
montrose-0.13.0 lib/montrose/rule/between.rb
montrose-0.12.0 lib/montrose/rule/between.rb