File: alarm.rb

package info (click to toggle)
mhc 1.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,452 kB
  • sloc: ruby: 12,700; lisp: 7,577; makefile: 70; sh: 68
file content (390 lines) | stat: -rw-r--r-- 14,200 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
module RiCal
  module Properties #:nodoc:
    #- ©2009 Rick DeNatale
    #- All rights reserved. Refer to the file README.txt for the license
    #
    # Properties::Alarm provides property accessing methods for the Alarm class
    # This source file is generated by the  rical:gen_propmodules rake tasks, DO NOT EDIT
    module Alarm

      # return the the ACTION property
      # which will be an instances of RiCal::PropertyValueText
      # 
      # [purpose (from RFC 2445)]
      # This property defines the action to be invoked when an alarm is triggered
      # 
      # see RFC 2445 4.8.6.1 p 126
      def action_property
        @action_property
      end

      # set the ACTION property
      # property value should be an instance of RiCal::PropertyValueText
      def action_property=(property_value)
        @action_property = property_value
      end

      # set the value of the ACTION property
      def action=(ruby_value)
        self.action_property= RiCal::PropertyValue::Text.convert(self, ruby_value)
      end

      # return the value of the ACTION property
      # which will be an instance of String
      def action
        action_property ? action_property.ruby_value : nil
      end

      def action_property_from_string(line) # :nodoc:
        @action_property = RiCal::PropertyValue::Text.new(self, line)
      end


      # return the the DESCRIPTION property
      # which will be an instances of RiCal::PropertyValueText
      # 
      # [purpose (from RFC 2445)]
      # This property provides a more complete description of the calendar component, than that provided by the "SUMMARY" property.
      # 
      # see RFC 2445 4.8.1.5 pp 81-82
      def description_property
        @description_property
      end

      # set the DESCRIPTION property
      # property value should be an instance of RiCal::PropertyValueText
      def description_property=(property_value)
        @description_property = property_value
      end

      # set the value of the DESCRIPTION property
      def description=(ruby_value)
        self.description_property= RiCal::PropertyValue::Text.convert(self, ruby_value)
      end

      # return the value of the DESCRIPTION property
      # which will be an instance of String
      def description
        description_property ? description_property.ruby_value : nil
      end

      def description_property_from_string(line) # :nodoc:
        @description_property = RiCal::PropertyValue::Text.new(self, line)
      end


      # return the the TRIGGER property
      # which will be an instances of RiCal::PropertyValueDuration
      # 
      # [purpose (from RFC 2445)]
      # This property specifies when an alarm will trigger.
      # 
      # see RFC 2445 4.8.6.3 p 127-129
      def trigger_property
        @trigger_property
      end

      # set the TRIGGER property
      # property value should be an instance of RiCal::PropertyValueDuration
      def trigger_property=(property_value)
        @trigger_property = property_value
      end

      # set the value of the TRIGGER property
      def trigger=(ruby_value)
        self.trigger_property= RiCal::PropertyValue::Duration.convert(self, ruby_value)
      end

      # return the value of the TRIGGER property
      # which will be an instance of Duration
      def trigger
        trigger_property ? trigger_property.ruby_value : nil
      end

      def trigger_property_from_string(line) # :nodoc:
        @trigger_property = RiCal::PropertyValue::Duration.new(self, line)
      end


      # return the the DURATION property
      # which will be an instances of RiCal::PropertyValueDuration
      # 
      # [purpose (from RFC 2445)]
      # This property specifies a positive duration of time.
      # 
      # see RFC 2445 4.8.2.5 pp 94-95
      def duration_property
        @duration_property
      end

      # set the DURATION property
      # property value should be an instance of RiCal::PropertyValueDuration
      def duration_property=(property_value)
        @duration_property = property_value
      end

      # set the value of the DURATION property
      def duration=(ruby_value)
        self.duration_property= RiCal::PropertyValue::Duration.convert(self, ruby_value)
      end

      # return the value of the DURATION property
      # which will be an instance of Duration
      def duration
        duration_property ? duration_property.ruby_value : nil
      end

      def duration_property_from_string(line) # :nodoc:
        @duration_property = RiCal::PropertyValue::Duration.new(self, line)
      end


      # return the the REPEAT property
      # which will be an instances of RiCal::PropertyValueInteger
      # 
      # [purpose (from RFC 2445)]
      # This property defines the number of times the alarm should be repeated, after the initial trigger.
      # 
      # see RFC 2445 4.8.6.2 p 126-127
      def repeat_property
        @repeat_property
      end

      # set the REPEAT property
      # property value should be an instance of RiCal::PropertyValueInteger
      def repeat_property=(property_value)
        @repeat_property = property_value
      end

      # set the value of the REPEAT property
      def repeat=(ruby_value)
        self.repeat_property= RiCal::PropertyValue::Integer.convert(self, ruby_value)
      end

      # return the value of the REPEAT property
      # which will be an instance of Integer
      def repeat
        repeat_property ? repeat_property.ruby_value : nil
      end

      def repeat_property_from_string(line) # :nodoc:
        @repeat_property = RiCal::PropertyValue::Integer.new(self, line)
      end


      # return the the SUMMARY property
      # which will be an instances of RiCal::PropertyValueText
      # 
      # [purpose (from RFC 2445)]
      # This property defines a short summary or subject for the calendar component.
      # 
      # see RFC 2445 4.8.1.12 pp 89-90
      def summary_property
        @summary_property
      end

      # set the SUMMARY property
      # property value should be an instance of RiCal::PropertyValueText
      def summary_property=(property_value)
        @summary_property = property_value
      end

      # set the value of the SUMMARY property
      def summary=(ruby_value)
        self.summary_property= RiCal::PropertyValue::Text.convert(self, ruby_value)
      end

      # return the value of the SUMMARY property
      # which will be an instance of String
      def summary
        summary_property ? summary_property.ruby_value : nil
      end

      def summary_property_from_string(line) # :nodoc:
        @summary_property = RiCal::PropertyValue::Text.new(self, line)
      end


      # return the the ATTENDEE property
      # which will be an array of instances of RiCal::PropertyValueCalAddress
      # 
      # [purpose (from RFC 2445)]
      # The property defines an 'Attendee' within a calendar component.
      # 
      # see RFC 2445 4.8.4.1 pp 102-104
      def attendee_property
        @attendee_property ||= []
      end

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

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

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

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

      # add one value to the ATTENDEE property
      # one instances of CalAddress may be passed to this method
      def  add_attendee(ruby_value)
       self.attendee_property << RiCal::PropertyValue::CalAddress.convert(self, ruby_value)
      end

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

      # remove one value from the ATTENDEE property
      # one instances of CalAddress may be passed to this method
      def  remove_attendee(ruby_value)
       self.attendee_property.delete(RiCal::PropertyValue::CalAddress.convert(self, ruby_value))
      end

      # return the value of the ATTENDEE property
      # which will be an array of instances of CalAddress
      def attendee
        attendee_property.map {|prop| prop ? prop.ruby_value : prop}
      end

      def attendee_property_from_string(line) # :nodoc:
        attendee_property << RiCal::PropertyValue::CalAddress.new(self, line)
      end

      # return the the ATTACH property
      # which will be an array of instances of RiCal::PropertyValueUri
      # 
      # [purpose (from RFC 2445)]
      # The property provides the capability to associate a document object with a calendar component.
      # 
      # see RFC 2445 4.8.1.1 pp 77-78
      def attach_property
        @attach_property ||= []
      end

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

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

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

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

      # add one value to the ATTACH property
      # one instances of Uri may be passed to this method
      def  add_attach(ruby_value)
       self.attach_property << RiCal::PropertyValue::Uri.convert(self, ruby_value)
      end

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

      # remove one value from the ATTACH property
      # one instances of Uri may be passed to this method
      def  remove_attach(ruby_value)
       self.attach_property.delete(RiCal::PropertyValue::Uri.convert(self, ruby_value))
      end

      # return the value of the ATTACH property
      # which will be an array of instances of Uri
      def attach
        attach_property.map {|prop| prop ? prop.ruby_value : prop}
      end

      def attach_property_from_string(line) # :nodoc:
        attach_property << RiCal::PropertyValue::Uri.new(self, line)
      end

      def export_properties_to(export_stream) #:nodoc:
        export_prop_to(export_stream, "DURATION", @duration_property)
        export_prop_to(export_stream, "ATTENDEE", @attendee_property)
        export_prop_to(export_stream, "TRIGGER", @trigger_property)
        export_prop_to(export_stream, "DESCRIPTION", @description_property)
        export_prop_to(export_stream, "SUMMARY", @summary_property)
        export_prop_to(export_stream, "REPEAT", @repeat_property)
        export_prop_to(export_stream, "ATTACH", @attach_property)
        export_prop_to(export_stream, "ACTION", @action_property)
      end

      def ==(o) #:nodoc:
        if o.class == self.class
        (duration_property == o.duration_property) &&
        (attendee_property == o.attendee_property) &&
        (trigger_property == o.trigger_property) &&
        (description_property == o.description_property) &&
        (summary_property == o.summary_property) &&
        (repeat_property == o.repeat_property) &&
        (attach_property == o.attach_property) &&
        (action_property == o.action_property)
        else
           super
        end
      end

      def initialize_copy(o) #:nodoc:
        super
        duration_property = duration_property && duration_property.dup
        attendee_property = attendee_property && attendee_property.dup
        trigger_property = trigger_property && trigger_property.dup
        description_property = description_property && description_property.dup
        summary_property = summary_property && summary_property.dup
        repeat_property = repeat_property && repeat_property.dup
        attach_property = attach_property && attach_property.dup
        action_property = action_property && action_property.dup
      end

      def add_date_times_to(required_timezones) #:nodoc:
      end

      module ClassMethods #:nodoc:
        def property_parser #:nodoc:
          {"ACTION"=>:action_property_from_string, "REPEAT"=>:repeat_property_from_string, "ATTENDEE"=>:attendee_property_from_string, "TRIGGER"=>:trigger_property_from_string, "ATTACH"=>:attach_property_from_string, "SUMMARY"=>:summary_property_from_string, "DESCRIPTION"=>:description_property_from_string, "DURATION"=>:duration_property_from_string}
        end
      end

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

      def mutual_exclusion_violation #:nodoc:
        false
      end
    end
  end
end