Class: Montrose::Rule::Covering

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

Defined Under Namespace

Classes: DateRange

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Montrose::Rule

#advance!, included

Constructor Details

#initialize(covering) ⇒ Covering

Initializes rule

Parameters:

  • covering (Range)
    • timestamp range



16
17
18
19
20
21
22
23
# File 'lib/montrose/rule/covering.rb', line 16

def initialize(covering)
  @covering = case covering.first
  when Date
    DateRange.new(covering)
  else
    covering
  end
end

Class Method Details

.apply_options(opts) ⇒ Object



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

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

Instance Method Details

#continue?(time) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/montrose/rule/covering.rb', line 29

def continue?(time)
  time < @covering.last
end

#include?(time) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/montrose/rule/covering.rb', line 25

def include?(time)
  @covering.include?(time)
end