Class: Zsnap::Rule
- Inherits:
-
Object
- Object
- Zsnap::Rule
- Defined in:
- lib/zsnap.rb
Direct Known Subclasses
Instance Method Summary collapse
- #condition_met?(time_minutes) ⇒ Boolean
-
#initialize(args = {}) ⇒ Rule
constructor
A new instance of Rule.
Constructor Details
#initialize(args = {}) ⇒ Rule
Returns a new instance of Rule.
33 34 35 36 37 |
# File 'lib/zsnap.rb', line 33 def initialize(args = {}) args = { 'offset' => 0, 'at_multiple' => 60 }.merge(args) @at_multiple = args['at_multiple'].to_i @offset = args['offset'].to_i end |
Instance Method Details
#condition_met?(time_minutes) ⇒ Boolean
39 40 41 42 |
# File 'lib/zsnap.rb', line 39 def condition_met?(time_minutes) divisor = @at_multiple (divisor == 0) or ((time_minutes - @offset) % divisor) == 0 end |