File: timezone_period.rb

package info (click to toggle)
mhc 1.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,320 kB
  • ctags: 3,529
  • sloc: ruby: 12,404; lisp: 7,448; makefile: 70; sh: 69
file content (416 lines) | stat: -rw-r--r-- 16,412 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
module RiCal
  module Properties #:nodoc:
    #- ©2009 Rick DeNatale
    #- All rights reserved. Refer to the file README.txt for the license
    #
    # Properties::TimezonePeriod provides property accessing methods for the TimezonePeriod class
    # This source file is generated by the  rical:gen_propmodules rake tasks, DO NOT EDIT
    module TimezonePeriod

      # return the the DTSTART property
      # which will be an instances of either RiCal::PropertyValue::DateTime or RiCal::PropertyValue::Date
      # 
      # [purpose (from RFC 2445)]
      # This property specifies when the calendar component begins.
      # 
      # see RFC 2445 4.8.2.4 pp 93-94
      def dtstart_property
        @dtstart_property
      end

      # set the DTSTART property
      # property value should be an instance of either RiCal::PropertyValue::DateTime or RiCal::PropertyValue::Date
      def dtstart_property=(property_value)
        @dtstart_property = property_value ? property_value.for_parent(self) : nil
      end

      # set the value of the DTSTART property
      def dtstart=(ruby_value)
        self.dtstart_property= RiCal::PropertyValue::DateTime.convert(self, ruby_value)
      end

      # return the value of the DTSTART property
      # which will be an instance of either DateTime or Date
      def dtstart
        dtstart_property ? dtstart_property.ruby_value : nil
      end

      def dtstart_property_from_string(line) # :nodoc:
        @dtstart_property = RiCal::PropertyValue::DateTime.or_date(self, line)
      end


      # return the the TZOFFSETTO property
      # which will be an instances of RiCal::PropertyValueUtcOffset
      # 
      # [purpose (from RFC 2445)]
      # This property specifies the offset which is in use in this time zone observance
      # 
      # see RFC 2445 4.8.3.4 pp 100-101
      def tzoffsetto_property
        @tzoffsetto_property
      end

      # set the TZOFFSETTO property
      # property value should be an instance of RiCal::PropertyValueUtcOffset
      def tzoffsetto_property=(property_value)
        @tzoffsetto_property = property_value
      end

      # set the value of the TZOFFSETTO property
      def tzoffsetto=(ruby_value)
        self.tzoffsetto_property= RiCal::PropertyValue::UtcOffset.convert(self, ruby_value)
      end

      # return the value of the TZOFFSETTO property
      # which will be an instance of UtcOffset
      def tzoffsetto
        tzoffsetto_property ? tzoffsetto_property.ruby_value : nil
      end

      def tzoffsetto_property_from_string(line) # :nodoc:
        @tzoffsetto_property = RiCal::PropertyValue::UtcOffset.new(self, line)
      end


      # return the the TZOFFSETFROM property
      # which will be an instances of RiCal::PropertyValueUtcOffset
      # 
      # [purpose (from RFC 2445)]
      # This property specifies the offset which is in use prior to this time zone observance
      # 
      # see RFC 2445 4.8.3.3 pp 99-100
      def tzoffsetfrom_property
        @tzoffsetfrom_property
      end

      # set the TZOFFSETFROM property
      # property value should be an instance of RiCal::PropertyValueUtcOffset
      def tzoffsetfrom_property=(property_value)
        @tzoffsetfrom_property = property_value
      end

      # set the value of the TZOFFSETFROM property
      def tzoffsetfrom=(ruby_value)
        self.tzoffsetfrom_property= RiCal::PropertyValue::UtcOffset.convert(self, ruby_value)
      end

      # return the value of the TZOFFSETFROM property
      # which will be an instance of UtcOffset
      def tzoffsetfrom
        tzoffsetfrom_property ? tzoffsetfrom_property.ruby_value : nil
      end

      def tzoffsetfrom_property_from_string(line) # :nodoc:
        @tzoffsetfrom_property = RiCal::PropertyValue::UtcOffset.new(self, line)
      end


      # return the the COMMENT property
      # which will be an array of instances of RiCal::PropertyValueText
      # 
      # [purpose (from RFC 2445)]
      # This property specifies non-processing information intended to provide a comment to the calendar user.
      # 
      # see RFC 2445 4.8.1.4 pp 80-81
      def comment_property
        @comment_property ||= []
      end

      # set the the COMMENT property
      # one or more instances of RiCal::PropertyValueText may be passed to this method
      def comment_property=(*property_values)
        @comment_property= property_values
      end

      # set the value of the COMMENT property to multiple values
      # one or more instances of String may be passed to this method
      def comments=(ruby_values)
        @comment_property = ruby_values.map {|val| RiCal::PropertyValue::Text.convert(self, val)}
      end

      # set the value of the COMMENT property to a single value
      # one instance of String may be passed to this method
      def comment=(ruby_value)
        @comment_property = [RiCal::PropertyValue::Text.convert(self, ruby_value)]
      end

      # add one or more values to the COMMENT property
      # one or more instances of String may be passed to this method
      def  add_comments(*ruby_values)
       ruby_values.each {|val|  self.comment_property << RiCal::PropertyValue::Text.convert(self, val)}
      end

      # add one value to the COMMENT property
      # one instances of String may be passed to this method
      def  add_comment(ruby_value)
       self.comment_property << RiCal::PropertyValue::Text.convert(self, ruby_value)
      end

      # remove one or more values from the COMMENT property
      # one or more instances of String may be passed to this method
      def  remove_comments(*ruby_values)
       ruby_values.each {|val|  self.comment_property.delete(RiCal::PropertyValue::Text.convert(self, val))}
      end

      # remove one value from the COMMENT property
      # one instances of String may be passed to this method
      def  remove_comment(ruby_value)
       self.comment_property.delete(RiCal::PropertyValue::Text.convert(self, ruby_value))
      end

      # return the value of the COMMENT property
      # which will be an array of instances of String
      def comment
        comment_property.map {|prop| prop ? prop.ruby_value : prop}
      end

      def comment_property_from_string(line) # :nodoc:
        comment_property << RiCal::PropertyValue::Text.new(self, line)
      end

      # return the the RDATE property
      # which will be an array of instances of RiCal::PropertyValueOccurrenceList
      # 
      # [purpose (from RFC 2445)]
      # This property defines the list of date/times for a recurring calendar component.
      # 
      # see RFC 2445 4.8.5.3 pp 115-117
      def rdate_property
        @rdate_property ||= []
      end

      # set the the RDATE property
      # one or more instances of RiCal::PropertyValueOccurrenceList may be passed to this method
      def rdate_property=(*property_values)
        @rdate_property= property_values.map{|prop| prop.for_parent(self)}
      end

      # set the value of the RDATE property to multiple values
      # one or more instances of OccurrenceList may be passed to this method
      def rdates=(ruby_values)
        @rdate_property = ruby_values.map {|val| RiCal::PropertyValue::OccurrenceList.convert(self, *val)}
      end

      # set the value of the RDATE property to a single value
      # one instance of OccurrenceList may be passed to this method
      def rdate=(*ruby_value)
        @rdate_property = [RiCal::PropertyValue::OccurrenceList.convert(self, *ruby_value)]
      end

      # add one or more values to the RDATE property
      # one or more instances of OccurrenceList may be passed to this method
      def  add_rdates(*ruby_values)
       ruby_values.each {|val|  self.rdate_property << RiCal::PropertyValue::OccurrenceList.convert(self, *val)}
      end

      # add one value to the RDATE property
      # one instances of OccurrenceList may be passed to this method
      def  add_rdate(*ruby_value)
       self.rdate_property << RiCal::PropertyValue::OccurrenceList.convert(self, *ruby_value)
      end

      # remove one or more values from the RDATE property
      # one or more instances of OccurrenceList may be passed to this method
      def  remove_rdates(*ruby_values)
       ruby_values.each {|val|  self.rdate_property.delete(RiCal::PropertyValue::OccurrenceList.convert(self, *val))}
      end

      # remove one value from the RDATE property
      # one instances of OccurrenceList may be passed to this method
      def  remove_rdate(*ruby_value)
       self.rdate_property.delete(RiCal::PropertyValue::OccurrenceList.convert(self, *ruby_value))
      end

      # return the value of the RDATE property
      # which will be an array of instances of OccurrenceList
      def rdate
        rdate_property.map {|prop| prop ? prop.ruby_value : prop}
      end

      def rdate_property_from_string(line) # :nodoc:
        rdate_property << RiCal::PropertyValue::OccurrenceList.new(self, line)
      end

      # return the the RRULE property
      # which will be an array of instances of RiCal::PropertyValueRecurrenceRule
      # 
      # [purpose (from RFC 2445)]
      # This property defines a rule or repeating pattern for recurring events, to-dos, or time zone definitions.
      # 
      # see RFC 2445 4.8.5.4 pp 117-125
      def rrule_property
        @rrule_property ||= []
      end

      # set the the RRULE property
      # one or more instances of RiCal::PropertyValueRecurrenceRule may be passed to this method
      def rrule_property=(*property_values)
        @rrule_property= property_values
      end

      # set the value of the RRULE property to multiple values
      # one or more instances of RecurrenceRule may be passed to this method
      def rrules=(ruby_values)
        @rrule_property = ruby_values.map {|val| RiCal::PropertyValue::RecurrenceRule.convert(self, val)}
      end

      # set the value of the RRULE property to a single value
      # one instance of RecurrenceRule may be passed to this method
      def rrule=(ruby_value)
        @rrule_property = [RiCal::PropertyValue::RecurrenceRule.convert(self, ruby_value)]
      end

      # add one or more values to the RRULE property
      # one or more instances of RecurrenceRule may be passed to this method
      def  add_rrules(*ruby_values)
       ruby_values.each {|val|  self.rrule_property << RiCal::PropertyValue::RecurrenceRule.convert(self, val)}
      end

      # add one value to the RRULE property
      # one instances of RecurrenceRule may be passed to this method
      def  add_rrule(ruby_value)
       self.rrule_property << RiCal::PropertyValue::RecurrenceRule.convert(self, ruby_value)
      end

      # remove one or more values from the RRULE property
      # one or more instances of RecurrenceRule may be passed to this method
      def  remove_rrules(*ruby_values)
       ruby_values.each {|val|  self.rrule_property.delete(RiCal::PropertyValue::RecurrenceRule.convert(self, val))}
      end

      # remove one value from the RRULE property
      # one instances of RecurrenceRule may be passed to this method
      def  remove_rrule(ruby_value)
       self.rrule_property.delete(RiCal::PropertyValue::RecurrenceRule.convert(self, ruby_value))
      end

      # return the value of the RRULE property
      # which will be an array of instances of RecurrenceRule
      def rrule
        rrule_property.map {|prop| prop ? prop.ruby_value : prop}
      end

      def rrule_property_from_string(line) # :nodoc:
        rrule_property << RiCal::PropertyValue::RecurrenceRule.new(self, line)
      end

      # return the the TZNAME property
      # which will be an array of instances of RiCal::PropertyValueText
      # 
      # [purpose (from RFC 2445)]
      # This property specifies the customary designation for a time zone description.
      # 
      # see RFC 2445 4.8.3.2 p 99
      def tzname_property
        @tzname_property ||= []
      end

      # set the the TZNAME property
      # one or more instances of RiCal::PropertyValueText may be passed to this method
      def tzname_property=(*property_values)
        @tzname_property= property_values
      end

      # set the value of the TZNAME property to multiple values
      # one or more instances of String may be passed to this method
      def tznames=(ruby_values)
        @tzname_property = ruby_values.map {|val| RiCal::PropertyValue::Text.convert(self, val)}
      end

      # set the value of the TZNAME property to a single value
      # one instance of String may be passed to this method
      def tzname=(ruby_value)
        @tzname_property = [RiCal::PropertyValue::Text.convert(self, ruby_value)]
      end

      # add one or more values to the TZNAME property
      # one or more instances of String may be passed to this method
      def  add_tznames(*ruby_values)
       ruby_values.each {|val|  self.tzname_property << RiCal::PropertyValue::Text.convert(self, val)}
      end

      # add one value to the TZNAME property
      # one instances of String may be passed to this method
      def  add_tzname(ruby_value)
       self.tzname_property << RiCal::PropertyValue::Text.convert(self, ruby_value)
      end

      # remove one or more values from the TZNAME property
      # one or more instances of String may be passed to this method
      def  remove_tznames(*ruby_values)
       ruby_values.each {|val|  self.tzname_property.delete(RiCal::PropertyValue::Text.convert(self, val))}
      end

      # remove one value from the TZNAME property
      # one instances of String may be passed to this method
      def  remove_tzname(ruby_value)
       self.tzname_property.delete(RiCal::PropertyValue::Text.convert(self, ruby_value))
      end

      # return the value of the TZNAME property
      # which will be an array of instances of String
      def tzname
        tzname_property.map {|prop| prop ? prop.ruby_value : prop}
      end

      def tzname_property_from_string(line) # :nodoc:
        tzname_property << RiCal::PropertyValue::Text.new(self, line)
      end

      def export_properties_to(export_stream) #:nodoc:
        export_prop_to(export_stream, "RDATE", @rdate_property)
        export_prop_to(export_stream, "TZOFFSETTO", @tzoffsetto_property)
        export_prop_to(export_stream, "DTSTART", @dtstart_property)
        export_prop_to(export_stream, "TZNAME", @tzname_property)
        export_prop_to(export_stream, "TZOFFSETFROM", @tzoffsetfrom_property)
        export_prop_to(export_stream, "RRULE", @rrule_property)
        export_prop_to(export_stream, "COMMENT", @comment_property)
      end

      def ==(o) #:nodoc:
        if o.class == self.class
        (rdate_property == o.rdate_property) &&
        (tzoffsetto_property == o.tzoffsetto_property) &&
        (dtstart_property == o.dtstart_property) &&
        (tzname_property == o.tzname_property) &&
        (tzoffsetfrom_property == o.tzoffsetfrom_property) &&
        (rrule_property == o.rrule_property) &&
        (comment_property == o.comment_property)
        else
           super
        end
      end

      def initialize_copy(o) #:nodoc:
        super
        rdate_property = rdate_property && rdate_property.dup
        tzoffsetto_property = tzoffsetto_property && tzoffsetto_property.dup
        dtstart_property = dtstart_property && dtstart_property.dup
        tzname_property = tzname_property && tzname_property.dup
        tzoffsetfrom_property = tzoffsetfrom_property && tzoffsetfrom_property.dup
        rrule_property = rrule_property && rrule_property.dup
        comment_property = comment_property && comment_property.dup
      end

      def add_date_times_to(required_timezones) #:nodoc:
        add_property_date_times_to(required_timezones, dtstart_property)
        add_property_date_times_to(required_timezones, rdate_property)
      end

      module ClassMethods #:nodoc:
        def property_parser #:nodoc:
          {"RDATE"=>:rdate_property_from_string, "COMMENT"=>:comment_property_from_string, "RRULE"=>:rrule_property_from_string, "TZOFFSETFROM"=>:tzoffsetfrom_property_from_string, "TZNAME"=>:tzname_property_from_string, "TZOFFSETTO"=>:tzoffsetto_property_from_string, "DTSTART"=>:dtstart_property_from_string}
        end
      end

      def self.included(mod) #:nodoc:
        mod.extend ClassMethods
      end

      def mutual_exclusion_violation #:nodoc:
        false
      end
    end
  end
end