Class: IceCube::MinutelyRule
- Defined in:
- lib/ice_cube/rules/minutely_rule.rb
Instance Attribute Summary
Attributes inherited from Rule
#occurrence_count, #until_date, #validations
Instance Method Summary collapse
-
#in_interval?(date, start_date) ⇒ Boolean
Determine whether this rule occurs on a give date.
- #to_ical ⇒ Object
- #to_s ⇒ Object
Methods inherited from Rule
#count, daily, from_hash, from_yaml, hourly, minutely, monthly, #next_suggestion, secondly, #to_hash, #to_yaml, #until, #validate_single_date, weekly, yearly
Methods included from ValidationTypes
#day, #day_of_month, #day_of_week, #day_of_year, #hour_of_day, #minute_of_hour, #month_of_year, #second_of_minute
Instance Method Details
#in_interval?(date, start_date) ⇒ Boolean
Determine whether this rule occurs on a give date.
6 7 8 9 10 |
# File 'lib/ice_cube/rules/minutely_rule.rb', line 6 def in_interval?(date, start_date) #make sure we're in a proper interval day_count = ((date - start_date) / IceCube::ONE_MINUTE).to_i day_count % @interval == 0 end |
#to_ical ⇒ Object
12 13 14 |
# File 'lib/ice_cube/rules/minutely_rule.rb', line 12 def to_ical 'FREQ=MINUTELY' << to_ical_base end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/ice_cube/rules/minutely_rule.rb', line 16 def to_s to_s_base 'Minutely', "Every #{@interval} minutes" end |