Class: RiCal::PropertyValue::RecurrenceRule::OccurrenceIncrementer::YearlyIncrementer
- Inherits:
-
FrequencyIncrementer
- Object
- RiCal::PropertyValue::RecurrenceRule::OccurrenceIncrementer
- FrequencyIncrementer
- RiCal::PropertyValue::RecurrenceRule::OccurrenceIncrementer::YearlyIncrementer
- Defined in:
- lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/yearly_incrementer.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#wkst ⇒ Object
readonly
Returns the value of attribute wkst.
Attributes inherited from FrequencyIncrementer
#interval, #outer_occurrence, #skip_increment
Attributes inherited from RiCal::PropertyValue::RecurrenceRule::OccurrenceIncrementer
#contains_daily_incrementer, #contains_weeknum_incrementer, #current_occurrence, #leaf_iterator, #outer_incrementers, #outer_range, #sub_cycle_incrementer
Class Method Summary collapse
Instance Method Summary collapse
- #advance_what ⇒ Object
- #end_of_occurrence(date_time) ⇒ Object
-
#initialize(rrule, sub_cycle_incrementer) ⇒ YearlyIncrementer
constructor
A new instance of YearlyIncrementer.
- #start_of_cycle(date_time) ⇒ Object
- #step(date_time) ⇒ Object
Methods inherited from FrequencyIncrementer
conditional_incrementer, #first_within_outer_cycle, #multiplier, #next_cycle, #sub_cycle_incrementer
Methods inherited from RiCal::PropertyValue::RecurrenceRule::OccurrenceIncrementer
#add_outer_incrementer, #contains_daily_incrementer?, #contains_weeknum_incrementer?, #daily_incrementer?, #first_sub_occurrence, #in_outer_cycle?, #next_cycle, #next_time, #outermost?, #short_name, #to_s, #update_cycle_range, #weeknum_incrementer?
Methods included from TimeManipulation
#advance_day, #advance_month, #advance_week, #advance_year, #first_day_of_month, #first_day_of_week, #first_day_of_year, #first_hour_of_day
Constructor Details
#initialize(rrule, sub_cycle_incrementer) ⇒ YearlyIncrementer
Returns a new instance of YearlyIncrementer.
9 10 11 12 |
# File 'lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/yearly_incrementer.rb', line 9 def initialize(rrule, sub_cycle_incrementer) @wkst = rrule.wkst_day super(rrule, sub_cycle_incrementer) end |
Instance Attribute Details
#wkst ⇒ Object (readonly)
Returns the value of attribute wkst.
7 8 9 |
# File 'lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/yearly_incrementer.rb', line 7 def wkst @wkst end |
Class Method Details
.from_rrule(rrule, start_time) ⇒ Object
14 15 16 |
# File 'lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/yearly_incrementer.rb', line 14 def self.from_rrule(rrule, start_time) conditional_incrementer(rrule, "YEARLY", ByMonthIncrementer) end |
Instance Method Details
#advance_what ⇒ Object
18 19 20 |
# File 'lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/yearly_incrementer.rb', line 18 def advance_what :years end |
#end_of_occurrence(date_time) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/yearly_incrementer.rb', line 44 def end_of_occurrence(date_time) if contains_weeknum_incrementer? date_time.end_of_iso_year(wkst) else date_time.end_of_year end end |
#start_of_cycle(date_time) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/yearly_incrementer.rb', line 34 def start_of_cycle(date_time) if contains_weeknum_incrementer? date_time.at_start_of_iso_year(wkst) elsif contains_daily_incrementer? date_time.change(:month => 1, :day => 1) else date_time.change(:month => 1) end end |
#step(date_time) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/yearly_incrementer.rb', line 22 def step(date_time) if contains_weeknum_incrementer? result = date_time multiplier.times do result = result.at_start_of_next_iso_year(wkst) end result else super(date_time) end end |