Class: RiCal::PropertyValue::RecurrenceRule::ByMonthIncrementer

Inherits:
ListIncrementer show all
Defined in:
lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from ListIncrementer

#cycle_start, #list, #occurrences, #outer_occurrence

Attributes inherited from 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

Methods inherited from ListIncrementer

conditional_incrementer, #cycle_adjust, #first_within_outer_cycle, #get_next_occurrences, #initialize, #next_candidate, #next_cycle, #next_in_list, #occurrences_within

Methods inherited from OccurrenceIncrementer

#add_outer_incrementer, #contains_daily_incrementer?, #contains_weeknum_incrementer?, #daily_incrementer?, #first_sub_occurrence, #in_outer_cycle?, #initialize, #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

This class inherits a constructor from RiCal::PropertyValue::RecurrenceRule::ListIncrementer

Class Method Details

.for_rrule(rrule) ⇒ Object



703
704
705
# File 'lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb', line 703

def self.for_rrule(rrule)
  conditional_incrementer(rrule, :bymonth, MonthlyIncrementer)
end

Instance Method Details

#advance_cycle(date_time) ⇒ Object



731
732
733
734
735
736
737
# File 'lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb', line 731

def advance_cycle(date_time)
  if contains_daily_incrementer?
    first_day_of_year(advance_year(date_time))
  else
    advance_year(date_time).change(:month => 1)
  end
end

#end_of_occurrence(date_time) ⇒ Object



739
740
741
# File 'lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb', line 739

def end_of_occurrence(date_time)
  date_time.end_of_month
end

#occurrences_for(date_time) ⇒ Object



707
708
709
710
711
712
713
# File 'lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb', line 707

def occurrences_for(date_time)
  if contains_daily_incrementer?
    list.map {|value| date_time.change(:month => value, :day => 1)}
  else
    list.map {|value| date_time.in_month(value)}
  end
end

#range_advance(date_time) ⇒ Object



715
716
717
# File 'lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb', line 715

def range_advance(date_time)
  advance_year(date_time)
end

#start_of_cycle(date_time) ⇒ Object



719
720
721
722
723
724
725
# File 'lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb', line 719

def start_of_cycle(date_time)
  if contains_daily_incrementer?
    date_time.change(:month => 1, :day => 1)
  else
    date_time.change(:month => 1)
  end
end

#varying_time_attributeObject



727
728
729
# File 'lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb', line 727

def varying_time_attribute
  :month
end