Class: Montrose::Rule::Total
- Inherits:
-
Object
- Object
- Montrose::Rule::Total
- Includes:
- Montrose::Rule
- Defined in:
- lib/montrose/rule/total.rb
Class Method Summary collapse
Instance Method Summary collapse
- #advance!(time) ⇒ Object
- #continue?(_time) ⇒ Boolean
- #include?(time) ⇒ Boolean
-
#initialize(max) ⇒ Total
constructor
A new instance of Total.
Methods included from Montrose::Rule
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.(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
26 27 28 |
# File 'lib/montrose/rule/total.rb', line 26 def continue?(_time) @count <= @max end |
#include?(time) ⇒ Boolean
17 18 19 |
# File 'lib/montrose/rule/total.rb', line 17 def include?(time) continue?(time) end |