Class: IceCube::MinutelyRule

Inherits:
Rule
  • Object
show all
Defined in:
lib/ice_cube/rules/minutely_rule.rb

Constant Summary

Constants inherited from Rule

Rule::SuggestionTypes

Instance Attribute Summary

Attributes inherited from Rule

#occurrence_count, #until_date, #validations

Instance Method Summary collapse

Methods inherited from Rule

#count, daily, from_hash, hourly, minutely, monthly, #next_suggestion, secondly, #to_hash, #to_s, #until, #validate_single_date, weekly, yearly

Methods included from HourOfDayValidation

#closest_hour_of_day, #hour_of_day, included, #validate_hour_of_day

Methods included from MinuteOfHourValidation

#closest_minute_of_hour, included, #minute_of_hour, #validate_minute_of_hour

Methods included from SecondOfMinuteValidation

#closest_second_of_minute, included, #second_of_minute, #validate_second_of_minute

Methods included from MonthOfYearValidation

#closest_month_of_year, included, #month_of_year, #validate_month_of_year

Methods included from DayOfYearValidation

#closest_day_of_year, #day_of_year, included, #validate_day_of_year

Methods included from DayOfMonthValidation

#closest_day_of_month, #day_of_month, included, #validate_day_of_month

Methods included from DayOfWeekValidation

#closest_day_of_week, #day_of_week, included, #validate_day_of_week

Methods included from DayValidation

#closest_day, #day, included, #validate_day

Instance Method Details

#in_interval?(date, start_date) ⇒ Boolean

Determine whether this rule occurs on a give date.

Returns:

  • (Boolean)


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_icalObject



12
13
14
# File 'lib/ice_cube/rules/minutely_rule.rb', line 12

def to_ical 
  'FREQ=MINUTELY' << to_ical_base
end