Class: Montrose::Rule::Total

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Montrose::Rule

included

Constructor Details

#initialize(max) ⇒ Total

Returns a new instance of Total


11
12
13
14
# File 'lib/montrose/rule/total.rb', line 11

def initialize(max)
  @max = max
  @count = 0
end

Class Method Details

.apply_options(opts) ⇒ Object


7
8
9
# File 'lib/montrose/rule/total.rb', line 7

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

Instance Method Details

#advance!(_time) ⇒ Object


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

def advance!(_time)
  @count += 1
  continue?
end

#continue?Boolean

Returns:

  • (Boolean)

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

def continue?
  @count <= @max
end

#include?(_time) ⇒ Boolean

Returns:

  • (Boolean)

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

def include?(_time)
  continue?
end