Class: IceCube::DailyRule

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

Instance Attribute Summary

Attributes inherited from Rule

#occurrence_count, #until_date, #validations

Instance Method Summary collapse

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

TODO repair Determine whether this rule occurs on a give date.

Returns:

  • (Boolean)


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

def in_interval?(date, start_date)
  #make sure we're in a proper interval
  day_count = ((date - start_date) / IceCube::ONE_DAY).to_i
  day_count % @interval == 0
  true
end

#to_icalObject



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

def to_ical 
  'FREQ=DAILY' << to_ical_base
end

#to_sObject



18
19
20
# File 'lib/ice_cube/rules/daily_rule.rb', line 18

def to_s
  to_s_base 'Daily', "Every #{@interval} days"
end