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.



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

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

Class Method Details

.apply_options(opts) ⇒ Object



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

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

Instance Method Details

#advance!(time) ⇒ Object



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

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

#continue?(_time) ⇒ Boolean

Returns:

  • (Boolean)


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

def continue?(_time)
  @count <= @max
end

#include?(time) ⇒ Boolean

Returns:

  • (Boolean)


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

def include?(time)
  continue?(time)
end