Class: Cyclical::DailyRule

Inherits:
Rule
  • Object
show all
Defined in:
lib/cyclical/rules/daily_rule.rb

Overview

holds daily rule configuration

Instance Attribute Summary

Attributes inherited from Rule

#interval

Instance Method Summary collapse

Methods inherited from Rule

#count, daily, #filters, #finite?, from_hash, from_json, #infinite?, #initialize, #match?, #monthdays, monthly, #months, #next, #previous, #stop, #to_hash, #to_json, #weekdays, weekly, #yeardays, yearly

Constructor Details

This class inherits a constructor from Cyclical::Rule

Instance Method Details

#aligned?(time, base) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
# File 'lib/cyclical/rules/daily_rule.rb', line 7

def aligned?(time, base)
  return false unless (base.to_date - time.to_date) % @interval == 0
  return false unless [time.hour, time.min, time.sec] == [base.hour, base.min, base.sec]

  true
end

#stepObject



14
15
16
# File 'lib/cyclical/rules/daily_rule.rb', line 14

def step
  @interval.days
end