Class: RiCal::PropertyValue::RecurrenceRule
- Inherits:
-
RiCal::PropertyValue
- Object
- RiCal::PropertyValue
- RiCal::PropertyValue::RecurrenceRule
- Defined in:
- lib/ri_cal/property_value/recurrence_rule.rb,
lib/ri_cal/property_value/recurrence_rule/enumerator.rb,
lib/ri_cal/property_value/recurrence_rule/validations.rb,
lib/ri_cal/property_value/recurrence_rule/numbered_span.rb,
lib/ri_cal/property_value/recurrence_rule/recurring_day.rb,
lib/ri_cal/property_value/recurrence_rule/time_manipulation.rb,
lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb,
lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb,
lib/ri_cal/property_value/recurrence_rule/initialization_methods.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/recurring_numbered_week.rb,
lib/ri_cal/property_value/recurrence_rule/negative_setpos_enumerator.rb,
lib/ri_cal/property_value/recurrence_rule/enumeration_support_methods.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/list_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/daily_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_day_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/hourly_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/weekly_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/yearly_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_hour_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/monthly_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_month_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/minutely_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/secondly_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_minute_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_second_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_weekno_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/frequency_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_yearday_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_monthday_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/null_sub_cycle_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb
Overview
-
©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
RiCal::PropertyValue::RecurrenceRule represents an icalendar Recurrence Rule property value which is defined in rfc 2445 section 4.3.10 pp 40-45
Defined Under Namespace
Modules: EnumerationSupportMethods, InitializationMethods, TimeManipulation, Validations Classes: Enumerator, NegativeSetposEnumerator, NumberedSpan, OccurrenceIncrementer, RecurringDay, RecurringMonthDay, RecurringNumberedWeek, RecurringYearDay
Instance Attribute Summary collapse
-
#count ⇒ Object
The integer count value of the receiver, or nil.
-
#until ⇒ Object
The DATE-TIME value of until limit of the receiver, or nil.
Attributes included from InitializationMethods
Attributes inherited from RiCal::PropertyValue
Class Method Summary collapse
-
.convert(parent, value) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#bounded? ⇒ Boolean
Predicate to determine if the receiver generates a bounded or infinite set of occurrences.
-
#freq ⇒ Object
return the frequency of the rule which will be a string.
-
#freq=(freq_value) ⇒ Object
- Set the frequency of the recurrence rule freq_value
-
a String which should be in %w[SECONDLY MINUTELY HOURLY DAILY WEEKLY MONTHLY YEARLY].
-
#initialize(parent, value_hash) ⇒ RecurrenceRule
constructor
:nodoc:.
-
#interval ⇒ Object
return the INTERVAL parameter of the recurrence rule This returns an Integer.
-
#interval=(interval_value) ⇒ Object
Set the INTERVAL parameter of the recurrence rule.
-
#to_ical ⇒ Object
Return a string containing the RFC 2445 representation of the recurrence rule.
-
#value ⇒ Object
:nodoc:.
-
#value=(string) ⇒ Object
:nodoc:.
-
#wkst ⇒ Object
return the starting week day for the recurrence rule, which for a valid instance will be one of “SU”, “MO”, “TU”, “WE”, “TH”, “FR”, or “SA”.
-
#wkst=(value) ⇒ Object
Set the starting week day for the recurrence rule, which should be one of “SU”, “MO”, “TU”, “WE”, “TH”, “FR”, or “SA” for the instance to be valid.
-
#wkst_day ⇒ Object
:nodoc:.
Methods included from EnumerationSupportMethods
#adjust_start, #by_rule_list, #enumerator, #exhausted?, #in_same_set?, #incrementer_from_start_time
Methods included from InitializationMethods
#add_byrule_strings_to_options_hash, #add_to_options_hash, #by_list, #byday=, #byhour=, #byminute=, #bymonth=, #bymonthday=, #bysecond=, #bysetpos=, #byweekno=, #byyearday=, #calc_by_day_scope, #init_by_lists, #initialize_from_value_part, #to_options_hash
Methods included from Validations
#errors, #reset_errors, #valid?, #validate, #validate_byday_list, #validate_bymonthday_list, #validate_bysetpos, #validate_byweekno_list, #validate_byyearday_list, #validate_freq, #validate_int_by_list, #validate_interval, #validate_termination, #validate_wkst
Methods inherited from RiCal::PropertyValue
#==, #add_date_times_to, date_or_date_time, date_or_date_time_or_period, #default_tzid, #enumerator, #equality_value, #find_timezone, #for_parent, if_valid_string, #parms_string, #ruby_value, #to_options_hash, #to_ri_cal_property_value, #to_s, #tz_info_source?, #validate_value, #visible_params
Constructor Details
#initialize(parent, value_hash) ⇒ RecurrenceRule
:nodoc:
23 24 25 26 27 28 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 23 def initialize(parent, value_hash) # :nodoc: @by_list_hash = {} super init_by_lists @by_list_hash = nil end |
Instance Attribute Details
#count ⇒ Object
The integer count value of the receiver, or nil
44 45 46 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 44 def count @count end |
#until ⇒ Object
The DATE-TIME value of until limit of the receiver, or nil
46 47 48 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 46 def until @until end |
Class Method Details
Instance Method Details
#bounded? ⇒ Boolean
Predicate to determine if the receiver generates a bounded or infinite set of occurrences
149 150 151 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 149 def bounded? @count || @until end |
#freq ⇒ Object
return the frequency of the rule which will be a string
68 69 70 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 68 def freq @freq.upcase end |
#freq=(freq_value) ⇒ Object
Set the frequency of the recurrence rule
- freq_value
-
a String which should be in %w[SECONDLY MINUTELY HOURLY DAILY WEEKLY MONTHLY YEARLY]
This method resets the receivers list of errors
62 63 64 65 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 62 def freq=(freq_value) reset_errors @freq = freq_value end |
#interval ⇒ Object
return the INTERVAL parameter of the recurrence rule This returns an Integer
116 117 118 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 116 def interval @interval ||= 1 end |
#interval=(interval_value) ⇒ Object
Set the INTERVAL parameter of the recurrence rule
- interval_value
-
an Integer
This method resets the receivers list of errors
125 126 127 128 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 125 def interval=(interval_value) reset_errors @interval = interval_value end |
#to_ical ⇒ Object
Return a string containing the RFC 2445 representation of the recurrence rule
135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 135 def to_ical result = ["FREQ=#{freq}"] result << "INTERVAL=#{interval}" unless interval == 1 result << "COUNT=#{count}" if count result << "UNTIL=#{self.until.value}" if self.until %w{bysecond byminute byhour byday bymonthday byyearday byweekno bymonth bysetpos}.each do |by_part| val = by_list[by_part.to_sym] result << "#{by_part.upcase}=#{[val].flatten.join(',')}" if val end result << "WKST=#{wkst}" unless wkst == "MO" result.join(";") end |
#value ⇒ Object
:nodoc:
130 131 132 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 130 def value #:nodoc: @value || to_ical end |
#value=(string) ⇒ Object
:nodoc:
48 49 50 51 52 53 54 55 56 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 48 def value=(string) # :nodoc: if string @value = string dup_hash = {} string.split(";").each do |value_part| initialize_from_value_part(value_part, dup_hash) end end end |
#wkst ⇒ Object
return the starting week day for the recurrence rule, which for a valid instance will be one of “SU”, “MO”, “TU”, “WE”, “TH”, “FR”, or “SA”
74 75 76 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 74 def wkst @wkst || 'MO' end |
#wkst=(value) ⇒ Object
Set the starting week day for the recurrence rule, which should be one of “SU”, “MO”, “TU”, “WE”, “TH”, “FR”, or “SA” for the instance to be valid. The parameter is however case-insensitive.
This method resets the receivers list of errors
87 88 89 90 91 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 87 def wkst=(value) reset_errors @wkst = value @wkst_day = nil end |
#wkst_day ⇒ Object
:nodoc:
78 79 80 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 78 def wkst_day # :nodoc: @wkst_day ||= (%w{SU MO TU WE FR SA}.index(wkst) || 1) end |