Class: Montrose::Rule::Between

Inherits:
Object
  • Object
show all
Includes:
Montrose::Rule
Defined in:
lib/montrose/rule/between.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Montrose::Rule

#advance!, included

Constructor Details

#initialize(between) ⇒ Between

Initializes rule

Parameters:

  • between (Range)
    • timestamp range



16
17
18
# File 'lib/montrose/rule/between.rb', line 16

def initialize(between)
  @between = between
end

Class Method Details

.apply_options(opts) ⇒ Object



8
9
10
# File 'lib/montrose/rule/between.rb', line 8

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

Instance Method Details

#continue?(time) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/montrose/rule/between.rb', line 24

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

#include?(time) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/montrose/rule/between.rb', line 20

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