rubyredrick-ri_cal 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +19 -2
- data/Manifest.txt +6 -3
- data/README.txt +130 -44
- data/Rakefile +1 -1
- data/copyrights.txt +1 -2
- data/lib/ri_cal/component/alarm.rb +1 -2
- data/lib/ri_cal/component/calendar.rb +25 -9
- data/lib/ri_cal/component/event.rb +1 -2
- data/lib/ri_cal/component/freebusy.rb +1 -2
- data/lib/ri_cal/component/journal.rb +1 -2
- data/lib/ri_cal/component/t_z_info_timezone.rb +1 -2
- data/lib/ri_cal/component/timezone/daylight_period.rb +1 -2
- data/lib/ri_cal/component/timezone/standard_period.rb +1 -2
- data/lib/ri_cal/component/timezone/timezone_period.rb +1 -2
- data/lib/ri_cal/component/timezone.rb +5 -2
- data/lib/ri_cal/component.rb +22 -7
- data/lib/ri_cal/core_extensions/date/conversions.rb +8 -7
- data/lib/ri_cal/core_extensions/date_time.rb +4 -2
- data/lib/ri_cal/core_extensions/object/conversions.rb +1 -1
- data/lib/ri_cal/core_extensions/string/conversions.rb +37 -6
- data/lib/ri_cal/core_extensions/time/conversions.rb +11 -7
- data/lib/ri_cal/core_extensions/time/tzid_access.rb +37 -0
- data/lib/ri_cal/core_extensions/time.rb +3 -1
- data/lib/ri_cal/floating_timezone.rb +32 -0
- data/lib/ri_cal/invalid_property_value.rb +8 -0
- data/lib/ri_cal/invalid_timezone_identifer.rb +2 -2
- data/lib/ri_cal/occurrence_enumerator.rb +5 -3
- data/lib/ri_cal/parser.rb +8 -8
- data/lib/ri_cal/properties/alarm.rb +8 -8
- data/lib/ri_cal/properties/event.rb +60 -60
- data/lib/ri_cal/properties/freebusy.rb +16 -16
- data/lib/ri_cal/properties/journal.rb +58 -58
- data/lib/ri_cal/properties/timezone_period.rb +23 -23
- data/lib/ri_cal/properties/todo.rb +63 -64
- data/lib/ri_cal/property_value/array.rb +10 -2
- data/lib/ri_cal/property_value/cal_address.rb +1 -2
- data/lib/ri_cal/property_value/date.rb +15 -3
- data/lib/ri_cal/property_value/date_time/additive_methods.rb +34 -33
- data/lib/ri_cal/property_value/date_time/time_machine.rb +175 -174
- data/lib/ri_cal/property_value/date_time/timezone_support.rb +70 -52
- data/lib/ri_cal/property_value/date_time.rb +47 -77
- data/lib/ri_cal/property_value/duration.rb +6 -3
- data/lib/ri_cal/property_value/geo.rb +1 -2
- data/lib/ri_cal/property_value/integer.rb +1 -2
- data/lib/ri_cal/property_value/occurrence_list.rb +79 -26
- data/lib/ri_cal/property_value/period.rb +23 -3
- data/lib/ri_cal/property_value/recurrence_rule/enumeration_support_methods.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/enumerator.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/initialization_methods.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/negative_setpos_enumerator.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/numbered_span.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/recurring_day.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/recurring_numbered_week.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/validations.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule.rb +3 -4
- data/lib/ri_cal/property_value/text.rb +1 -2
- data/lib/ri_cal/property_value/uri.rb +1 -2
- data/lib/ri_cal/property_value/utc_offset.rb +1 -2
- data/lib/ri_cal/property_value.rb +42 -11
- data/lib/ri_cal/required_timezones.rb +1 -2
- data/lib/ri_cal.rb +1 -2
- data/ri_cal.gemspec +6 -4
- data/spec/ri_cal/component/alarm_spec.rb +1 -2
- data/spec/ri_cal/component/calendar_spec.rb +1 -2
- data/spec/ri_cal/component/event_spec.rb +168 -13
- data/spec/ri_cal/component/freebusy_spec.rb +1 -2
- data/spec/ri_cal/component/journal_spec.rb +1 -2
- data/spec/ri_cal/component/t_z_info_timezone_spec.rb +1 -2
- data/spec/ri_cal/component/timezone_spec.rb +1 -2
- data/spec/ri_cal/component/todo_spec.rb +4 -5
- data/spec/ri_cal/component_spec.rb +30 -18
- data/spec/ri_cal/core_extensions/string/conversions_spec.rb +78 -0
- data/spec/ri_cal/core_extensions/time/calculations_spec.rb +1 -2
- data/spec/ri_cal/core_extensions/time/week_day_predicates_spec.rb +1 -2
- data/spec/ri_cal/occurrence_enumerator_spec.rb +23 -2
- data/spec/ri_cal/parser_spec.rb +6 -7
- data/spec/ri_cal/property_value/date_spec.rb +1 -2
- data/spec/ri_cal/property_value/date_time_spec.rb +54 -119
- data/spec/ri_cal/property_value/duration_spec.rb +12 -2
- data/spec/ri_cal/property_value/occurrence_list_spec.rb +67 -0
- data/spec/ri_cal/property_value/period_spec.rb +1 -2
- data/spec/ri_cal/property_value/recurrence_rule/recurring_year_day_spec.rb +1 -2
- data/spec/ri_cal/property_value/recurrence_rule_spec.rb +1 -2
- data/spec/ri_cal/property_value/text_spec.rb +1 -2
- data/spec/ri_cal/property_value/utc_offset_spec.rb +1 -2
- data/spec/ri_cal/property_value_spec.rb +19 -8
- data/spec/ri_cal/required_timezones_spec.rb +1 -2
- data/spec/ri_cal_spec.rb +1 -2
- data/spec/spec_helper.rb +2 -7
- data/tasks/ri_cal.rake +20 -13
- data/tasks/spec.rake +1 -1
- metadata +8 -5
- data/lib/ri_cal/core_extensions/date_time/conversions.rb +0 -27
- data/lib/ri_cal/time_with_floating_timezone.rb +0 -59
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
module RiCal
|
|
2
2
|
module Properties #:nodoc:
|
|
3
|
-
#- ©2009 Rick DeNatale
|
|
4
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
|
3
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
|
5
4
|
#
|
|
6
5
|
# Properties::Todo provides property accessing methods for the Todo class
|
|
7
6
|
# This source file is generated by the rical:gen_propmodules rake tasks, DO NOT EDIT
|
|
@@ -688,7 +687,7 @@ module RiCal
|
|
|
688
687
|
|
|
689
688
|
# set the value of the ATTACH property to multiple values
|
|
690
689
|
# one or more instances of Uri may be passed to this method
|
|
691
|
-
def attachments=(
|
|
690
|
+
def attachments=(ruby_values)
|
|
692
691
|
@attach_property = ruby_values.map {|val| RiCal::PropertyValue::Uri.convert(self, val)}
|
|
693
692
|
end
|
|
694
693
|
|
|
@@ -701,7 +700,7 @@ module RiCal
|
|
|
701
700
|
# add one or more values to the ATTACH property
|
|
702
701
|
# one or more instances of Uri may be passed to this method
|
|
703
702
|
def add_attachments(*ruby_values)
|
|
704
|
-
ruby_values.
|
|
703
|
+
ruby_values.each {|val| self.attach_property << RiCal::PropertyValue::Uri.convert(self, val)}
|
|
705
704
|
end
|
|
706
705
|
|
|
707
706
|
# add one value to the ATTACH property
|
|
@@ -713,7 +712,7 @@ module RiCal
|
|
|
713
712
|
# remove one or more values from the ATTACH property
|
|
714
713
|
# one or more instances of Uri may be passed to this method
|
|
715
714
|
def remove_attachments(*ruby_values)
|
|
716
|
-
ruby_values.
|
|
715
|
+
ruby_values.each {|val| self.attach_property.delete(RiCal::PropertyValue::Uri.convert(self, val))}
|
|
717
716
|
end
|
|
718
717
|
|
|
719
718
|
# remove one value from the ATTACH property
|
|
@@ -725,7 +724,7 @@ module RiCal
|
|
|
725
724
|
# return the value of the ATTACH property
|
|
726
725
|
# which will be an array of instances of Uri
|
|
727
726
|
def attach
|
|
728
|
-
attach_property.map {|prop| prop ? prop.
|
|
727
|
+
attach_property.map {|prop| prop ? prop.ruby_value : prop}
|
|
729
728
|
end
|
|
730
729
|
|
|
731
730
|
def attach_property_from_string(line) # :nodoc:
|
|
@@ -751,7 +750,7 @@ module RiCal
|
|
|
751
750
|
|
|
752
751
|
# set the value of the ATTENDEE property to multiple values
|
|
753
752
|
# one or more instances of CalAddress may be passed to this method
|
|
754
|
-
def attendees=(
|
|
753
|
+
def attendees=(ruby_values)
|
|
755
754
|
@attendee_property = ruby_values.map {|val| RiCal::PropertyValue::CalAddress.convert(self, val)}
|
|
756
755
|
end
|
|
757
756
|
|
|
@@ -764,7 +763,7 @@ module RiCal
|
|
|
764
763
|
# add one or more values to the ATTENDEE property
|
|
765
764
|
# one or more instances of CalAddress may be passed to this method
|
|
766
765
|
def add_attendees(*ruby_values)
|
|
767
|
-
ruby_values.
|
|
766
|
+
ruby_values.each {|val| self.attendee_property << RiCal::PropertyValue::CalAddress.convert(self, val)}
|
|
768
767
|
end
|
|
769
768
|
|
|
770
769
|
# add one value to the ATTENDEE property
|
|
@@ -776,7 +775,7 @@ module RiCal
|
|
|
776
775
|
# remove one or more values from the ATTENDEE property
|
|
777
776
|
# one or more instances of CalAddress may be passed to this method
|
|
778
777
|
def remove_attendees(*ruby_values)
|
|
779
|
-
ruby_values.
|
|
778
|
+
ruby_values.each {|val| self.attendee_property.delete(RiCal::PropertyValue::CalAddress.convert(self, val))}
|
|
780
779
|
end
|
|
781
780
|
|
|
782
781
|
# remove one value from the ATTENDEE property
|
|
@@ -788,7 +787,7 @@ module RiCal
|
|
|
788
787
|
# return the value of the ATTENDEE property
|
|
789
788
|
# which will be an array of instances of CalAddress
|
|
790
789
|
def attendee
|
|
791
|
-
attendee_property.map {|prop| prop ? prop.
|
|
790
|
+
attendee_property.map {|prop| prop ? prop.ruby_value : prop}
|
|
792
791
|
end
|
|
793
792
|
|
|
794
793
|
def attendee_property_from_string(line) # :nodoc:
|
|
@@ -814,7 +813,7 @@ module RiCal
|
|
|
814
813
|
|
|
815
814
|
# set the value of the CATEGORIES property to multiple values
|
|
816
815
|
# one or more instances of Array may be passed to this method
|
|
817
|
-
def multiple_categories=(
|
|
816
|
+
def multiple_categories=(ruby_values)
|
|
818
817
|
@categories_property = ruby_values.map {|val| RiCal::PropertyValue::Array.convert(self, val)}
|
|
819
818
|
end
|
|
820
819
|
|
|
@@ -827,7 +826,7 @@ module RiCal
|
|
|
827
826
|
# add one or more values to the CATEGORIES property
|
|
828
827
|
# one or more instances of Array may be passed to this method
|
|
829
828
|
def add_multiple_categories(*ruby_values)
|
|
830
|
-
ruby_values.
|
|
829
|
+
ruby_values.each {|val| self.categories_property << RiCal::PropertyValue::Array.convert(self, val)}
|
|
831
830
|
end
|
|
832
831
|
|
|
833
832
|
# add one value to the CATEGORIES property
|
|
@@ -839,7 +838,7 @@ module RiCal
|
|
|
839
838
|
# remove one or more values from the CATEGORIES property
|
|
840
839
|
# one or more instances of Array may be passed to this method
|
|
841
840
|
def remove_multiple_categories(*ruby_values)
|
|
842
|
-
ruby_values.
|
|
841
|
+
ruby_values.each {|val| self.categories_property.delete(RiCal::PropertyValue::Array.convert(self, val))}
|
|
843
842
|
end
|
|
844
843
|
|
|
845
844
|
# remove one value from the CATEGORIES property
|
|
@@ -851,7 +850,7 @@ module RiCal
|
|
|
851
850
|
# return the value of the CATEGORIES property
|
|
852
851
|
# which will be an array of instances of Array
|
|
853
852
|
def categories
|
|
854
|
-
categories_property.map {|prop| prop ? prop.
|
|
853
|
+
categories_property.map {|prop| prop ? prop.ruby_value : prop}
|
|
855
854
|
end
|
|
856
855
|
|
|
857
856
|
def categories_property_from_string(line) # :nodoc:
|
|
@@ -877,7 +876,7 @@ module RiCal
|
|
|
877
876
|
|
|
878
877
|
# set the value of the COMMENT property to multiple values
|
|
879
878
|
# one or more instances of String may be passed to this method
|
|
880
|
-
def comments=(
|
|
879
|
+
def comments=(ruby_values)
|
|
881
880
|
@comment_property = ruby_values.map {|val| RiCal::PropertyValue::Text.convert(self, val)}
|
|
882
881
|
end
|
|
883
882
|
|
|
@@ -890,7 +889,7 @@ module RiCal
|
|
|
890
889
|
# add one or more values to the COMMENT property
|
|
891
890
|
# one or more instances of String may be passed to this method
|
|
892
891
|
def add_comments(*ruby_values)
|
|
893
|
-
ruby_values.
|
|
892
|
+
ruby_values.each {|val| self.comment_property << RiCal::PropertyValue::Text.convert(self, val)}
|
|
894
893
|
end
|
|
895
894
|
|
|
896
895
|
# add one value to the COMMENT property
|
|
@@ -902,7 +901,7 @@ module RiCal
|
|
|
902
901
|
# remove one or more values from the COMMENT property
|
|
903
902
|
# one or more instances of String may be passed to this method
|
|
904
903
|
def remove_comments(*ruby_values)
|
|
905
|
-
ruby_values.
|
|
904
|
+
ruby_values.each {|val| self.comment_property.delete(RiCal::PropertyValue::Text.convert(self, val))}
|
|
906
905
|
end
|
|
907
906
|
|
|
908
907
|
# remove one value from the COMMENT property
|
|
@@ -914,7 +913,7 @@ module RiCal
|
|
|
914
913
|
# return the value of the COMMENT property
|
|
915
914
|
# which will be an array of instances of String
|
|
916
915
|
def comment
|
|
917
|
-
comment_property.map {|prop| prop ? prop.
|
|
916
|
+
comment_property.map {|prop| prop ? prop.ruby_value : prop}
|
|
918
917
|
end
|
|
919
918
|
|
|
920
919
|
def comment_property_from_string(line) # :nodoc:
|
|
@@ -940,7 +939,7 @@ module RiCal
|
|
|
940
939
|
|
|
941
940
|
# set the value of the CONTACT property to multiple values
|
|
942
941
|
# one or more instances of String may be passed to this method
|
|
943
|
-
def contacts=(
|
|
942
|
+
def contacts=(ruby_values)
|
|
944
943
|
@contact_property = ruby_values.map {|val| RiCal::PropertyValue::Text.convert(self, val)}
|
|
945
944
|
end
|
|
946
945
|
|
|
@@ -953,7 +952,7 @@ module RiCal
|
|
|
953
952
|
# add one or more values to the CONTACT property
|
|
954
953
|
# one or more instances of String may be passed to this method
|
|
955
954
|
def add_contacts(*ruby_values)
|
|
956
|
-
ruby_values.
|
|
955
|
+
ruby_values.each {|val| self.contact_property << RiCal::PropertyValue::Text.convert(self, val)}
|
|
957
956
|
end
|
|
958
957
|
|
|
959
958
|
# add one value to the CONTACT property
|
|
@@ -965,7 +964,7 @@ module RiCal
|
|
|
965
964
|
# remove one or more values from the CONTACT property
|
|
966
965
|
# one or more instances of String may be passed to this method
|
|
967
966
|
def remove_contacts(*ruby_values)
|
|
968
|
-
ruby_values.
|
|
967
|
+
ruby_values.each {|val| self.contact_property.delete(RiCal::PropertyValue::Text.convert(self, val))}
|
|
969
968
|
end
|
|
970
969
|
|
|
971
970
|
# remove one value from the CONTACT property
|
|
@@ -977,7 +976,7 @@ module RiCal
|
|
|
977
976
|
# return the value of the CONTACT property
|
|
978
977
|
# which will be an array of instances of String
|
|
979
978
|
def contact
|
|
980
|
-
contact_property.map {|prop| prop ? prop.
|
|
979
|
+
contact_property.map {|prop| prop ? prop.ruby_value : prop}
|
|
981
980
|
end
|
|
982
981
|
|
|
983
982
|
def contact_property_from_string(line) # :nodoc:
|
|
@@ -1003,44 +1002,44 @@ module RiCal
|
|
|
1003
1002
|
|
|
1004
1003
|
# set the value of the EXDATE property to multiple values
|
|
1005
1004
|
# one or more instances of OccurrenceList may be passed to this method
|
|
1006
|
-
def exdates=(
|
|
1007
|
-
@exdate_property = ruby_values.map {|val| RiCal::PropertyValue::OccurrenceList.convert(self, val)}
|
|
1005
|
+
def exdates=(ruby_values)
|
|
1006
|
+
@exdate_property = ruby_values.map {|val| RiCal::PropertyValue::OccurrenceList.convert(self, *val)}
|
|
1008
1007
|
end
|
|
1009
1008
|
|
|
1010
1009
|
# set the value of the EXDATE property to a single value
|
|
1011
1010
|
# one instance of OccurrenceList may be passed to this method
|
|
1012
|
-
def exdate=(ruby_value)
|
|
1013
|
-
@exdate_property = [RiCal::PropertyValue::OccurrenceList.convert(self, ruby_value)]
|
|
1011
|
+
def exdate=(*ruby_value)
|
|
1012
|
+
@exdate_property = [RiCal::PropertyValue::OccurrenceList.convert(self, *ruby_value)]
|
|
1014
1013
|
end
|
|
1015
1014
|
|
|
1016
1015
|
# add one or more values to the EXDATE property
|
|
1017
1016
|
# one or more instances of OccurrenceList may be passed to this method
|
|
1018
1017
|
def add_exdates(*ruby_values)
|
|
1019
|
-
ruby_values.
|
|
1018
|
+
ruby_values.each {|val| self.exdate_property << RiCal::PropertyValue::OccurrenceList.convert(self, *val)}
|
|
1020
1019
|
end
|
|
1021
1020
|
|
|
1022
1021
|
# add one value to the EXDATE property
|
|
1023
1022
|
# one instances of OccurrenceList may be passed to this method
|
|
1024
|
-
def add_exdate(ruby_value)
|
|
1025
|
-
self.exdate_property << RiCal::PropertyValue::OccurrenceList.convert(self, ruby_value)
|
|
1023
|
+
def add_exdate(*ruby_value)
|
|
1024
|
+
self.exdate_property << RiCal::PropertyValue::OccurrenceList.convert(self, *ruby_value)
|
|
1026
1025
|
end
|
|
1027
1026
|
|
|
1028
1027
|
# remove one or more values from the EXDATE property
|
|
1029
1028
|
# one or more instances of OccurrenceList may be passed to this method
|
|
1030
1029
|
def remove_exdates(*ruby_values)
|
|
1031
|
-
ruby_values.
|
|
1030
|
+
ruby_values.each {|val| self.exdate_property.delete(RiCal::PropertyValue::OccurrenceList.convert(self, *val))}
|
|
1032
1031
|
end
|
|
1033
1032
|
|
|
1034
1033
|
# remove one value from the EXDATE property
|
|
1035
1034
|
# one instances of OccurrenceList may be passed to this method
|
|
1036
|
-
def remove_exdate(ruby_value)
|
|
1037
|
-
self.exdate_property.delete(RiCal::PropertyValue::OccurrenceList.convert(self, ruby_value))
|
|
1035
|
+
def remove_exdate(*ruby_value)
|
|
1036
|
+
self.exdate_property.delete(RiCal::PropertyValue::OccurrenceList.convert(self, *ruby_value))
|
|
1038
1037
|
end
|
|
1039
1038
|
|
|
1040
1039
|
# return the value of the EXDATE property
|
|
1041
1040
|
# which will be an array of instances of OccurrenceList
|
|
1042
1041
|
def exdate
|
|
1043
|
-
exdate_property.map {|prop| prop ? prop.
|
|
1042
|
+
exdate_property.map {|prop| prop ? prop.ruby_value : prop}
|
|
1044
1043
|
end
|
|
1045
1044
|
|
|
1046
1045
|
def exdate_property_from_string(line) # :nodoc:
|
|
@@ -1066,7 +1065,7 @@ module RiCal
|
|
|
1066
1065
|
|
|
1067
1066
|
# set the value of the EXRULE property to multiple values
|
|
1068
1067
|
# one or more instances of RecurrenceRule may be passed to this method
|
|
1069
|
-
def exrules=(
|
|
1068
|
+
def exrules=(ruby_values)
|
|
1070
1069
|
@exrule_property = ruby_values.map {|val| RiCal::PropertyValue::RecurrenceRule.convert(self, val)}
|
|
1071
1070
|
end
|
|
1072
1071
|
|
|
@@ -1079,7 +1078,7 @@ module RiCal
|
|
|
1079
1078
|
# add one or more values to the EXRULE property
|
|
1080
1079
|
# one or more instances of RecurrenceRule may be passed to this method
|
|
1081
1080
|
def add_exrules(*ruby_values)
|
|
1082
|
-
ruby_values.
|
|
1081
|
+
ruby_values.each {|val| self.exrule_property << RiCal::PropertyValue::RecurrenceRule.convert(self, val)}
|
|
1083
1082
|
end
|
|
1084
1083
|
|
|
1085
1084
|
# add one value to the EXRULE property
|
|
@@ -1091,7 +1090,7 @@ module RiCal
|
|
|
1091
1090
|
# remove one or more values from the EXRULE property
|
|
1092
1091
|
# one or more instances of RecurrenceRule may be passed to this method
|
|
1093
1092
|
def remove_exrules(*ruby_values)
|
|
1094
|
-
ruby_values.
|
|
1093
|
+
ruby_values.each {|val| self.exrule_property.delete(RiCal::PropertyValue::RecurrenceRule.convert(self, val))}
|
|
1095
1094
|
end
|
|
1096
1095
|
|
|
1097
1096
|
# remove one value from the EXRULE property
|
|
@@ -1103,7 +1102,7 @@ module RiCal
|
|
|
1103
1102
|
# return the value of the EXRULE property
|
|
1104
1103
|
# which will be an array of instances of RecurrenceRule
|
|
1105
1104
|
def exrule
|
|
1106
|
-
exrule_property.map {|prop| prop ? prop.
|
|
1105
|
+
exrule_property.map {|prop| prop ? prop.ruby_value : prop}
|
|
1107
1106
|
end
|
|
1108
1107
|
|
|
1109
1108
|
def exrule_property_from_string(line) # :nodoc:
|
|
@@ -1126,7 +1125,7 @@ module RiCal
|
|
|
1126
1125
|
|
|
1127
1126
|
# set the value of the REQUEST-STATUS property to multiple values
|
|
1128
1127
|
# one or more instances of String may be passed to this method
|
|
1129
|
-
def request_statuses=(
|
|
1128
|
+
def request_statuses=(ruby_values)
|
|
1130
1129
|
@request_status_property = ruby_values.map {|val| RiCal::PropertyValue::Text.convert(self, val)}
|
|
1131
1130
|
end
|
|
1132
1131
|
|
|
@@ -1139,7 +1138,7 @@ module RiCal
|
|
|
1139
1138
|
# add one or more values to the REQUEST-STATUS property
|
|
1140
1139
|
# one or more instances of String may be passed to this method
|
|
1141
1140
|
def add_request_statuses(*ruby_values)
|
|
1142
|
-
ruby_values.
|
|
1141
|
+
ruby_values.each {|val| self.request_status_property << RiCal::PropertyValue::Text.convert(self, val)}
|
|
1143
1142
|
end
|
|
1144
1143
|
|
|
1145
1144
|
# add one value to the REQUEST-STATUS property
|
|
@@ -1151,7 +1150,7 @@ module RiCal
|
|
|
1151
1150
|
# remove one or more values from the REQUEST-STATUS property
|
|
1152
1151
|
# one or more instances of String may be passed to this method
|
|
1153
1152
|
def remove_request_statuses(*ruby_values)
|
|
1154
|
-
ruby_values.
|
|
1153
|
+
ruby_values.each {|val| self.request_status_property.delete(RiCal::PropertyValue::Text.convert(self, val))}
|
|
1155
1154
|
end
|
|
1156
1155
|
|
|
1157
1156
|
# remove one value from the REQUEST-STATUS property
|
|
@@ -1163,7 +1162,7 @@ module RiCal
|
|
|
1163
1162
|
# return the value of the REQUEST-STATUS property
|
|
1164
1163
|
# which will be an array of instances of String
|
|
1165
1164
|
def request_status
|
|
1166
|
-
request_status_property.map {|prop| prop ? prop.
|
|
1165
|
+
request_status_property.map {|prop| prop ? prop.ruby_value : prop}
|
|
1167
1166
|
end
|
|
1168
1167
|
|
|
1169
1168
|
def request_status_property_from_string(line) # :nodoc:
|
|
@@ -1189,7 +1188,7 @@ module RiCal
|
|
|
1189
1188
|
|
|
1190
1189
|
# set the value of the RELATED-TO property to multiple values
|
|
1191
1190
|
# one or more instances of String may be passed to this method
|
|
1192
|
-
def multiple_related_to=(
|
|
1191
|
+
def multiple_related_to=(ruby_values)
|
|
1193
1192
|
@related_to_property = ruby_values.map {|val| RiCal::PropertyValue::Text.convert(self, val)}
|
|
1194
1193
|
end
|
|
1195
1194
|
|
|
@@ -1202,7 +1201,7 @@ module RiCal
|
|
|
1202
1201
|
# add one or more values to the RELATED-TO property
|
|
1203
1202
|
# one or more instances of String may be passed to this method
|
|
1204
1203
|
def add_multiple_related_to(*ruby_values)
|
|
1205
|
-
ruby_values.
|
|
1204
|
+
ruby_values.each {|val| self.related_to_property << RiCal::PropertyValue::Text.convert(self, val)}
|
|
1206
1205
|
end
|
|
1207
1206
|
|
|
1208
1207
|
# add one value to the RELATED-TO property
|
|
@@ -1214,7 +1213,7 @@ module RiCal
|
|
|
1214
1213
|
# remove one or more values from the RELATED-TO property
|
|
1215
1214
|
# one or more instances of String may be passed to this method
|
|
1216
1215
|
def remove_multiple_related_to(*ruby_values)
|
|
1217
|
-
ruby_values.
|
|
1216
|
+
ruby_values.each {|val| self.related_to_property.delete(RiCal::PropertyValue::Text.convert(self, val))}
|
|
1218
1217
|
end
|
|
1219
1218
|
|
|
1220
1219
|
# remove one value from the RELATED-TO property
|
|
@@ -1226,7 +1225,7 @@ module RiCal
|
|
|
1226
1225
|
# return the value of the RELATED-TO property
|
|
1227
1226
|
# which will be an array of instances of String
|
|
1228
1227
|
def related_to
|
|
1229
|
-
related_to_property.map {|prop| prop ? prop.
|
|
1228
|
+
related_to_property.map {|prop| prop ? prop.ruby_value : prop}
|
|
1230
1229
|
end
|
|
1231
1230
|
|
|
1232
1231
|
def related_to_property_from_string(line) # :nodoc:
|
|
@@ -1252,7 +1251,7 @@ module RiCal
|
|
|
1252
1251
|
|
|
1253
1252
|
# set the value of the RESOURCES property to multiple values
|
|
1254
1253
|
# one or more instances of Array may be passed to this method
|
|
1255
|
-
def multiple_resources=(
|
|
1254
|
+
def multiple_resources=(ruby_values)
|
|
1256
1255
|
@resources_property = ruby_values.map {|val| RiCal::PropertyValue::Array.convert(self, val)}
|
|
1257
1256
|
end
|
|
1258
1257
|
|
|
@@ -1265,7 +1264,7 @@ module RiCal
|
|
|
1265
1264
|
# add one or more values to the RESOURCES property
|
|
1266
1265
|
# one or more instances of Array may be passed to this method
|
|
1267
1266
|
def add_multiple_resources(*ruby_values)
|
|
1268
|
-
ruby_values.
|
|
1267
|
+
ruby_values.each {|val| self.resources_property << RiCal::PropertyValue::Array.convert(self, val)}
|
|
1269
1268
|
end
|
|
1270
1269
|
|
|
1271
1270
|
# add one value to the RESOURCES property
|
|
@@ -1277,7 +1276,7 @@ module RiCal
|
|
|
1277
1276
|
# remove one or more values from the RESOURCES property
|
|
1278
1277
|
# one or more instances of Array may be passed to this method
|
|
1279
1278
|
def remove_multiple_resources(*ruby_values)
|
|
1280
|
-
ruby_values.
|
|
1279
|
+
ruby_values.each {|val| self.resources_property.delete(RiCal::PropertyValue::Array.convert(self, val))}
|
|
1281
1280
|
end
|
|
1282
1281
|
|
|
1283
1282
|
# remove one value from the RESOURCES property
|
|
@@ -1289,7 +1288,7 @@ module RiCal
|
|
|
1289
1288
|
# return the value of the RESOURCES property
|
|
1290
1289
|
# which will be an array of instances of Array
|
|
1291
1290
|
def resources
|
|
1292
|
-
resources_property.map {|prop| prop ? prop.
|
|
1291
|
+
resources_property.map {|prop| prop ? prop.ruby_value : prop}
|
|
1293
1292
|
end
|
|
1294
1293
|
|
|
1295
1294
|
def resources_property_from_string(line) # :nodoc:
|
|
@@ -1315,44 +1314,44 @@ module RiCal
|
|
|
1315
1314
|
|
|
1316
1315
|
# set the value of the RDATE property to multiple values
|
|
1317
1316
|
# one or more instances of OccurrenceList may be passed to this method
|
|
1318
|
-
def rdates=(
|
|
1319
|
-
@rdate_property = ruby_values.map {|val| RiCal::PropertyValue::OccurrenceList.convert(self, val)}
|
|
1317
|
+
def rdates=(ruby_values)
|
|
1318
|
+
@rdate_property = ruby_values.map {|val| RiCal::PropertyValue::OccurrenceList.convert(self, *val)}
|
|
1320
1319
|
end
|
|
1321
1320
|
|
|
1322
1321
|
# set the value of the RDATE property to a single value
|
|
1323
1322
|
# one instance of OccurrenceList may be passed to this method
|
|
1324
|
-
def rdate=(ruby_value)
|
|
1325
|
-
@rdate_property = [RiCal::PropertyValue::OccurrenceList.convert(self, ruby_value)]
|
|
1323
|
+
def rdate=(*ruby_value)
|
|
1324
|
+
@rdate_property = [RiCal::PropertyValue::OccurrenceList.convert(self, *ruby_value)]
|
|
1326
1325
|
end
|
|
1327
1326
|
|
|
1328
1327
|
# add one or more values to the RDATE property
|
|
1329
1328
|
# one or more instances of OccurrenceList may be passed to this method
|
|
1330
1329
|
def add_rdates(*ruby_values)
|
|
1331
|
-
ruby_values.
|
|
1330
|
+
ruby_values.each {|val| self.rdate_property << RiCal::PropertyValue::OccurrenceList.convert(self, *val)}
|
|
1332
1331
|
end
|
|
1333
1332
|
|
|
1334
1333
|
# add one value to the RDATE property
|
|
1335
1334
|
# one instances of OccurrenceList may be passed to this method
|
|
1336
|
-
def add_rdate(ruby_value)
|
|
1337
|
-
self.rdate_property << RiCal::PropertyValue::OccurrenceList.convert(self, ruby_value)
|
|
1335
|
+
def add_rdate(*ruby_value)
|
|
1336
|
+
self.rdate_property << RiCal::PropertyValue::OccurrenceList.convert(self, *ruby_value)
|
|
1338
1337
|
end
|
|
1339
1338
|
|
|
1340
1339
|
# remove one or more values from the RDATE property
|
|
1341
1340
|
# one or more instances of OccurrenceList may be passed to this method
|
|
1342
1341
|
def remove_rdates(*ruby_values)
|
|
1343
|
-
ruby_values.
|
|
1342
|
+
ruby_values.each {|val| self.rdate_property.delete(RiCal::PropertyValue::OccurrenceList.convert(self, *val))}
|
|
1344
1343
|
end
|
|
1345
1344
|
|
|
1346
1345
|
# remove one value from the RDATE property
|
|
1347
1346
|
# one instances of OccurrenceList may be passed to this method
|
|
1348
|
-
def remove_rdate(ruby_value)
|
|
1349
|
-
self.rdate_property.delete(RiCal::PropertyValue::OccurrenceList.convert(self, ruby_value))
|
|
1347
|
+
def remove_rdate(*ruby_value)
|
|
1348
|
+
self.rdate_property.delete(RiCal::PropertyValue::OccurrenceList.convert(self, *ruby_value))
|
|
1350
1349
|
end
|
|
1351
1350
|
|
|
1352
1351
|
# return the value of the RDATE property
|
|
1353
1352
|
# which will be an array of instances of OccurrenceList
|
|
1354
1353
|
def rdate
|
|
1355
|
-
rdate_property.map {|prop| prop ? prop.
|
|
1354
|
+
rdate_property.map {|prop| prop ? prop.ruby_value : prop}
|
|
1356
1355
|
end
|
|
1357
1356
|
|
|
1358
1357
|
def rdate_property_from_string(line) # :nodoc:
|
|
@@ -1378,7 +1377,7 @@ module RiCal
|
|
|
1378
1377
|
|
|
1379
1378
|
# set the value of the RRULE property to multiple values
|
|
1380
1379
|
# one or more instances of RecurrenceRule may be passed to this method
|
|
1381
|
-
def rrules=(
|
|
1380
|
+
def rrules=(ruby_values)
|
|
1382
1381
|
@rrule_property = ruby_values.map {|val| RiCal::PropertyValue::RecurrenceRule.convert(self, val)}
|
|
1383
1382
|
end
|
|
1384
1383
|
|
|
@@ -1391,7 +1390,7 @@ module RiCal
|
|
|
1391
1390
|
# add one or more values to the RRULE property
|
|
1392
1391
|
# one or more instances of RecurrenceRule may be passed to this method
|
|
1393
1392
|
def add_rrules(*ruby_values)
|
|
1394
|
-
ruby_values.
|
|
1393
|
+
ruby_values.each {|val| self.rrule_property << RiCal::PropertyValue::RecurrenceRule.convert(self, val)}
|
|
1395
1394
|
end
|
|
1396
1395
|
|
|
1397
1396
|
# add one value to the RRULE property
|
|
@@ -1403,7 +1402,7 @@ module RiCal
|
|
|
1403
1402
|
# remove one or more values from the RRULE property
|
|
1404
1403
|
# one or more instances of RecurrenceRule may be passed to this method
|
|
1405
1404
|
def remove_rrules(*ruby_values)
|
|
1406
|
-
ruby_values.
|
|
1405
|
+
ruby_values.each {|val| self.rrule_property.delete(RiCal::PropertyValue::RecurrenceRule.convert(self, val))}
|
|
1407
1406
|
end
|
|
1408
1407
|
|
|
1409
1408
|
# remove one value from the RRULE property
|
|
@@ -1415,7 +1414,7 @@ module RiCal
|
|
|
1415
1414
|
# return the value of the RRULE property
|
|
1416
1415
|
# which will be an array of instances of RecurrenceRule
|
|
1417
1416
|
def rrule
|
|
1418
|
-
rrule_property.map {|prop| prop ? prop.
|
|
1417
|
+
rrule_property.map {|prop| prop ? prop.ruby_value : prop}
|
|
1419
1418
|
end
|
|
1420
1419
|
|
|
1421
1420
|
def rrule_property_from_string(line) # :nodoc:
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
module RiCal
|
|
2
2
|
class PropertyValue
|
|
3
|
-
#- ©2009 Rick DeNatale
|
|
4
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
|
3
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
|
5
4
|
#
|
|
6
5
|
class Array < PropertyValue # :nodoc:
|
|
7
6
|
|
|
@@ -13,6 +12,15 @@ module RiCal
|
|
|
13
12
|
@value = val
|
|
14
13
|
end
|
|
15
14
|
end
|
|
15
|
+
|
|
16
|
+
def value
|
|
17
|
+
@value.join(",")
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.convert(timezone_finder, ruby_object) # :nodoc:
|
|
21
|
+
self.new(timezone_finder, :value => ruby_object)
|
|
22
|
+
end
|
|
23
|
+
|
|
16
24
|
end
|
|
17
25
|
end
|
|
18
26
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
module RiCal
|
|
2
2
|
class PropertyValue
|
|
3
|
-
#- ©2009 Rick DeNatale
|
|
4
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
|
3
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
|
5
4
|
#
|
|
6
5
|
# RiCal::PropertyValue::CalAddress represents an icalendar CalAddress property value
|
|
7
6
|
# which is defined in
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
require 'date'
|
|
2
2
|
module RiCal
|
|
3
3
|
class PropertyValue
|
|
4
|
-
#- ©2009 Rick DeNatale
|
|
5
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
|
6
5
|
#
|
|
7
6
|
# RiCal::PropertyValue::CalAddress represents an icalendar Date property value
|
|
8
7
|
# which is defined in
|
|
9
8
|
# RFC 2445 section 4.3.4 p 34
|
|
10
9
|
class Date < PropertyValue
|
|
10
|
+
|
|
11
|
+
def self.valid_string?(string) #:nodoc:
|
|
12
|
+
string =~ /^\d{8}$/
|
|
13
|
+
end
|
|
14
|
+
|
|
11
15
|
# Returns the value of the reciever as an RFC 2445 iCalendar string
|
|
12
16
|
def value
|
|
13
17
|
if @date_time_value
|
|
@@ -36,6 +40,14 @@ module RiCal
|
|
|
36
40
|
end
|
|
37
41
|
end
|
|
38
42
|
|
|
43
|
+
# Nop to allow occurrence list to try to set it
|
|
44
|
+
def tzid=(val)#:nodoc:
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def tzid #:nodoc:
|
|
48
|
+
nil
|
|
49
|
+
end
|
|
50
|
+
|
|
39
51
|
def visible_params #:nodoc:
|
|
40
52
|
{"VALUE" => "DATE"}.merge(params)
|
|
41
53
|
end
|
|
@@ -68,7 +80,7 @@ module RiCal
|
|
|
68
80
|
end
|
|
69
81
|
|
|
70
82
|
# Return this date property
|
|
71
|
-
def to_ri_cal_date_value
|
|
83
|
+
def to_ri_cal_date_value(timezone_finder = nil)
|
|
72
84
|
self
|
|
73
85
|
end
|
|
74
86
|
|
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
module RiCal
|
|
2
2
|
class PropertyValue
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
class DateTime
|
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
|
5
|
+
#
|
|
6
|
+
# Methods for DateTime which support adding or subtracting another DateTime or Duration
|
|
7
|
+
module AdditiveMethods
|
|
8
|
+
# if end_time is nil => nil
|
|
9
|
+
# otherwise convert end_time to a DateTime and compute the difference
|
|
10
|
+
def duration_until(end_time) # :nodoc:
|
|
11
|
+
end_time && RiCal::PropertyValue::Duration.from_datetimes(timezone_finder, to_datetime, end_time.to_datetime)
|
|
12
|
+
end
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
# Double-dispatch method for subtraction.
|
|
15
|
+
def subtract_from_date_time_value(dtvalue) #:nodoc:
|
|
16
|
+
RiCal::PropertyValue::Duration.from_datetimes(timezone_finder, to_datetime,dtvalue.to_datetime)
|
|
17
|
+
end
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
# Double-dispatch method for addition.
|
|
20
|
+
def add_to_date_time_value(date_time_value) #:nodoc:
|
|
21
|
+
raise ArgumentError.new("Cannot add #{date_time_value} to #{self}")
|
|
22
|
+
end
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
# Return the difference between the receiver and other
|
|
25
|
+
#
|
|
26
|
+
# The parameter other should be either a RiCal::PropertyValue::Duration or a RiCal::PropertyValue::DateTime
|
|
27
|
+
#
|
|
28
|
+
# If other is a Duration, the result will be a DateTime, if it is a DateTime the result will be a Duration
|
|
29
|
+
def -(other)
|
|
30
|
+
other.subtract_from_date_time_value(self)
|
|
31
|
+
end
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
# Return the sum of the receiver and duration
|
|
34
|
+
#
|
|
35
|
+
# The parameter other duration should be a RiCal::PropertyValue::Duration
|
|
36
|
+
#
|
|
37
|
+
# The result will be an RiCal::PropertyValue::DateTime
|
|
38
|
+
def +(duration)
|
|
39
|
+
duration.add_to_date_time_value(self)
|
|
40
|
+
end
|
|
40
41
|
end
|
|
41
42
|
end
|
|
42
43
|
end
|