Class: RiCal::PropertyValue::OccurrenceList

Inherits:
Array show all
Defined in:
lib/ri_cal/property_value/occurrence_list.rb

Overview

OccurrenceList is used to represent the value of an RDATE or EXDATE property.

  • ©2009 Rick DeNatale

  • All rights reserved. Refer to the file README.txt for the license

Defined Under Namespace

Classes: Enumerator

Instance Attribute Summary

Attributes inherited from RiCal::PropertyValue

#params, #timezone_finder, #value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RiCal::PropertyValue

#==, #add_date_times_to, date_or_date_time, #enumerator, #equality_value, #for_parent, from_string, #initialize, #parms_string, #ruby_value, #to_options_hash, #to_ri_cal_property_value, #to_s, #validate_value, #visible_params

Constructor Details

This class inherits a constructor from RiCal::PropertyValue

Class Method Details

.convert(timezone_finder, ruby_object) ⇒ Object

:nodoc:



31
32
33
34
35
36
37
38
# File 'lib/ri_cal/property_value/occurrence_list.rb', line 31

def self.convert(timezone_finder, ruby_object) # :nodoc:
  if PropertyValue::DateTime.single_time_or_date?(ruby_object)
    values = [ruby_object]
  else
    values = ruby_object
  end
  super(timezone_finder, values)
end

Instance Method Details

#value=(val) ⇒ Object

:nodoc:



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/ri_cal/property_value/occurrence_list.rb', line 40

def value=(val) #:nodoc:
  super
  case params[:value]
  when 'DATE-TIME', nil
    @elements = @value.map {|val| PropertyValue::DateTime.convert(self, val)}.sort
    @value = @elements.map {|element| element.value}
  when 'DATE'
    @elements = @value.map {|val| PropertyValue::Date.new(self, val)}.sort
    @value = @elements.map {|element| element.value}
  when 'PERIOD'
  end
end