tilia-vobject 4.0.0.pre.alpha5 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.sabre.md +59 -2
  3. data/Gemfile +1 -8
  4. data/Gemfile.lock +18 -12
  5. data/LICENSE +1 -1
  6. data/LICENSE.sabre +1 -1
  7. data/lib/tilia/v_object.rb +1 -0
  8. data/lib/tilia/v_object/birthday_calendar_generator.rb +11 -11
  9. data/lib/tilia/v_object/cli.rb +39 -38
  10. data/lib/tilia/v_object/component.rb +47 -50
  11. data/lib/tilia/v_object/component/available.rb +4 -37
  12. data/lib/tilia/v_object/component/v_alarm.rb +6 -18
  13. data/lib/tilia/v_object/component/v_availability.rb +6 -39
  14. data/lib/tilia/v_object/component/v_calendar.rb +66 -98
  15. data/lib/tilia/v_object/component/v_card.rb +42 -69
  16. data/lib/tilia/v_object/component/v_event.rb +5 -17
  17. data/lib/tilia/v_object/component/v_free_busy.rb +4 -16
  18. data/lib/tilia/v_object/component/v_journal.rb +16 -16
  19. data/lib/tilia/v_object/component/v_time_zone.rb +2 -14
  20. data/lib/tilia/v_object/component/v_todo.rb +17 -36
  21. data/lib/tilia/v_object/date_time_parser.rb +24 -24
  22. data/lib/tilia/v_object/document.rb +25 -25
  23. data/lib/tilia/v_object/free_busy_data.rb +7 -7
  24. data/lib/tilia/v_object/free_busy_generator.rb +73 -75
  25. data/lib/tilia/v_object/i_tip.rb +1 -0
  26. data/lib/tilia/v_object/i_tip/broker.rb +134 -116
  27. data/lib/tilia/v_object/i_tip/i_tip_exception.rb +1 -1
  28. data/lib/tilia/v_object/i_tip/message.rb +13 -13
  29. data/lib/tilia/v_object/invalid_data_exception.rb +8 -0
  30. data/lib/tilia/v_object/node.rb +22 -27
  31. data/lib/tilia/v_object/parameter.rb +22 -22
  32. data/lib/tilia/v_object/parse_exception.rb +1 -1
  33. data/lib/tilia/v_object/parser.rb +1 -0
  34. data/lib/tilia/v_object/parser/json.rb +9 -19
  35. data/lib/tilia/v_object/parser/mime_dir.rb +73 -39
  36. data/lib/tilia/v_object/parser/parser.rb +9 -14
  37. data/lib/tilia/v_object/parser/xml.rb +33 -50
  38. data/lib/tilia/v_object/parser/xml/element.rb +1 -0
  39. data/lib/tilia/v_object/parser/xml/element/key_value.rb +2 -2
  40. data/lib/tilia/v_object/property.rb +52 -52
  41. data/lib/tilia/v_object/property/binary.rb +10 -10
  42. data/lib/tilia/v_object/property/boolean.rb +6 -6
  43. data/lib/tilia/v_object/property/flat_text.rb +3 -3
  44. data/lib/tilia/v_object/property/float_value.rb +10 -10
  45. data/lib/tilia/v_object/property/i_calendar.rb +1 -0
  46. data/lib/tilia/v_object/property/i_calendar/cal_address.rb +3 -3
  47. data/lib/tilia/v_object/property/i_calendar/date_time.rb +29 -57
  48. data/lib/tilia/v_object/property/i_calendar/duration.rb +6 -6
  49. data/lib/tilia/v_object/property/i_calendar/period.rb +10 -10
  50. data/lib/tilia/v_object/property/i_calendar/recur.rb +16 -24
  51. data/lib/tilia/v_object/property/integer_value.rb +8 -8
  52. data/lib/tilia/v_object/property/text.rb +21 -36
  53. data/lib/tilia/v_object/property/time.rb +29 -6
  54. data/lib/tilia/v_object/property/unknown.rb +2 -2
  55. data/lib/tilia/v_object/property/uri.rb +24 -5
  56. data/lib/tilia/v_object/property/utc_offset.rb +5 -5
  57. data/lib/tilia/v_object/property/v_card.rb +1 -0
  58. data/lib/tilia/v_object/property/v_card/date.rb +3 -3
  59. data/lib/tilia/v_object/property/v_card/date_and_or_time.rb +30 -42
  60. data/lib/tilia/v_object/property/v_card/date_time.rb +1 -1
  61. data/lib/tilia/v_object/property/v_card/language_tag.rb +4 -4
  62. data/lib/tilia/v_object/property/v_card/time_stamp.rb +5 -5
  63. data/lib/tilia/v_object/reader.rb +12 -11
  64. data/lib/tilia/v_object/recur.rb +2 -0
  65. data/lib/tilia/v_object/recur/event_iterator.rb +30 -27
  66. data/lib/tilia/v_object/recur/max_instances_exceeded_exception.rb +10 -0
  67. data/lib/tilia/v_object/recur/no_instances_exception.rb +1 -1
  68. data/lib/tilia/v_object/recur/r_date_iterator.rb +15 -41
  69. data/lib/tilia/v_object/recur/r_rule_iterator.rb +23 -156
  70. data/lib/tilia/v_object/settings.rb +16 -0
  71. data/lib/tilia/v_object/splitter.rb +1 -0
  72. data/lib/tilia/v_object/splitter/i_calendar.rb +5 -5
  73. data/lib/tilia/v_object/splitter/splitter_interface.rb +2 -2
  74. data/lib/tilia/v_object/splitter/v_card.rb +5 -5
  75. data/lib/tilia/v_object/string_util.rb +25 -9
  76. data/lib/tilia/v_object/time_zone_data.rb +1 -0
  77. data/lib/tilia/v_object/time_zone_util.rb +6 -6
  78. data/lib/tilia/v_object/uuid_util.rb +3 -3
  79. data/lib/tilia/v_object/v_card_converter.rb +24 -21
  80. data/lib/tilia/v_object/version.rb +1 -1
  81. data/lib/tilia/v_object/writer.rb +7 -7
  82. data/test/test_helper.rb +3 -3
  83. data/test/v_object/birthday_calendar_generator_test.rb +22 -0
  84. data/test/v_object/component/v_alarm_test.rb +3 -1
  85. data/test/v_object/component/v_calendar_test.rb +40 -4
  86. data/test/v_object/component/v_card_test.rb +1 -1
  87. data/test/v_object/component_test.rb +5 -3
  88. data/test/v_object/date_time_parser_test.rb +15 -5
  89. data/test/v_object/free_busy_generator_test.rb +5 -5
  90. data/test/v_object/i_tip/broker_attendee_reply_test.rb +19 -0
  91. data/test/v_object/i_tip/broker_delete_event_test.rb +146 -2
  92. data/test/v_object/i_tip/broker_new_event_test.rb +21 -0
  93. data/test/v_object/i_tip/broker_process_reply_test.rb +10 -0
  94. data/test/v_object/i_tip/broker_tester.rb +1 -1
  95. data/test/v_object/i_tip/broker_update_event_test.rb +36 -0
  96. data/test/v_object/issue259_test.rb +24 -0
  97. data/test/v_object/issue40_test.rb +3 -1
  98. data/test/v_object/j_cal_test.rb +15 -12
  99. data/test/v_object/parser/json_test.rb +5 -5
  100. data/test/v_object/parser/mime_dir_test.rb +109 -0
  101. data/test/v_object/property/binary_test.rb +4 -2
  102. data/test/v_object/property/i_calendar/date_time_test.rb +3 -1
  103. data/test/v_object/property/uri_test.rb +23 -0
  104. data/test/v_object/recur/event_iterator/by_month_in_daily_test.rb +1 -1
  105. data/test/v_object/recur/event_iterator/by_set_pos_hang_test.rb +1 -1
  106. data/test/v_object/recur/event_iterator/expand_floating_times_test.rb +9 -9
  107. data/test/v_object/recur/event_iterator/handle_r_date_expand_test.rb +51 -0
  108. data/test/v_object/recur/event_iterator/incorrect_expand_test.rb +3 -5
  109. data/test/v_object/recur/event_iterator/infinite_loop_problem_test.rb +3 -1
  110. data/test/v_object/{issue26_test.rb → recur/event_iterator/issue26_test.rb} +3 -1
  111. data/test/v_object/recur/event_iterator/main_test.rb +9 -3
  112. data/test/v_object/recur/event_iterator/max_instances_test.rb +38 -0
  113. data/test/v_object/recur/event_iterator/missing_overridden_test.rb +3 -5
  114. data/test/v_object/recur/event_iterator/no_instances_test.rb +5 -3
  115. data/test/v_object/recur/event_iterator/override_first_event_test.rb +9 -9
  116. data/test/v_object/recur/r_date_iterator_test.rb +18 -0
  117. data/test/v_object/recur/r_rule_iterator_test.rb +4 -4
  118. data/test/v_object/splitter/i_calendar_test.rb +27 -7
  119. data/test/v_object/splitter/v_card_test.rb +5 -3
  120. data/test/v_object/test_case.rb +14 -4
  121. data/tilia-vobject.gemspec +2 -2
  122. metadata +17 -11
@@ -10,25 +10,28 @@ module Tilia
10
10
  # Sabre\VObject\Component\VCalendar
11
11
  # Sabre\VObject\Component\VCard
12
12
  class MimeDir < Parser
13
- # The input stream.
13
+ # The list of character sets we support when decoding.
14
14
  #
15
- # @var resource
16
- # RUBY: attr_accessor :input
15
+ # This would be a const expression but for now we need to support PHP 5.5
16
+ @supported_charsets = [
17
+ 'UTF-8',
18
+ 'ISO-8859-1',
19
+ 'Windows-1252'
20
+ ]
17
21
 
18
- # Root component.
19
- #
20
- # @var Component
21
- # RUBY: attr_accessor :root
22
+ class << self
23
+ attr_reader :supported_charsets
24
+ end
22
25
 
23
26
  # Parses an iCalendar or vCard file.
24
27
  #
25
28
  # Pass a stream or a string. If null is parsed, the existing buffer is
26
29
  # used.
27
30
  #
28
- # @param string|resource|null input
29
- # @param int options
31
+ # @param [String|resource, nil] input
32
+ # @param [Fixnum] options
30
33
  #
31
- # @return Sabre\VObject\Document
34
+ # @return [Document]
32
35
  def parse(input = nil, options = 0)
33
36
  @root = nil
34
37
 
@@ -40,11 +43,27 @@ module Tilia
40
43
  @root
41
44
  end
42
45
 
46
+ # By default all input will be assumed to be UTF-8.
47
+ #
48
+ # However, both iCalendar and vCard might be encoded using different
49
+ # character sets. The character set is usually set in the mime-type.
50
+ #
51
+ # If this is the case, use setEncoding to specify that a different
52
+ # encoding will be used. If this is set, the parser will automatically
53
+ # convert all incoming data to UTF-8.
54
+ #
55
+ # @param [String] charset
56
+ def charset=(charset)
57
+ fail ArgumentError, "Unsupported encoding. (Supported encodings: #{MimeDir.supported_charsets.join(', ')})" unless MimeDir.supported_charsets.include?(charset)
58
+
59
+ @charset = charset
60
+ end
61
+
43
62
  # Sets the input buffer. Must be a string or stream.
44
63
  #
45
- # @param resource|string input
64
+ # @param [IO, String] input
46
65
  #
47
- # @return void
66
+ # @return [void]
48
67
  def input=(input)
49
68
  # Resetting the parser
50
69
  @line_index = 0
@@ -67,7 +86,7 @@ module Tilia
67
86
 
68
87
  # Parses an entire document.
69
88
  #
70
- # @return void
89
+ # @return [void]
71
90
  def parse_document
72
91
  line = read_line
73
92
 
@@ -77,11 +96,11 @@ module Tilia
77
96
 
78
97
  case line.upcase
79
98
  when 'BEGIN:VCALENDAR'
80
- klass = Tilia::VObject::Component::VCalendar
99
+ klass = Component::VCalendar.component_map['VCALENDAR']
81
100
  when 'BEGIN:VCARD'
82
- klass = Tilia::VObject::Component::VCard
101
+ klass = Component::VCard.component_map['VCARD']
83
102
  else
84
- fail Tilia::VObject::ParseException, 'This parser only supports VCARD and VCALENDAR files'
103
+ fail ParseException, 'This parser only supports VCARD and VCALENDAR files'
85
104
  end
86
105
 
87
106
  @root = klass.new({}, false)
@@ -95,17 +114,15 @@ module Tilia
95
114
  end
96
115
 
97
116
  name = line[4..-1].upcase
98
- if name != @root.name
99
- fail Tilia::VObject::ParseException, "Invalid MimeDir file. expected: \"END:#{@root.name}\" got: \"END:#{name}\""
100
- end
117
+ fail Tilia::VObject::ParseException, "Invalid MimeDir file. expected: \"END:#{@root.name}\" got: \"END:#{name}\"" unless name == @root.name
101
118
  end
102
119
 
103
120
  # Parses a line, and if it hits a component, it will also attempt to parse
104
121
  # the entire component.
105
122
  #
106
- # @param string line Unfolded line
123
+ # @param [String] line Unfolded line
107
124
  #
108
- # @return Node
125
+ # @return [Node]
109
126
  def parse_line(line)
110
127
  # Start of a new component
111
128
  if line[0...6].upcase == 'BEGIN:'
@@ -143,7 +160,7 @@ module Tilia
143
160
  #
144
161
  # If that was not the case, we store it here.
145
162
  #
146
- # @var null|string
163
+ # @return [null|string]
147
164
  # RUBY: attr_accessor :protected line_buffer
148
165
 
149
166
  # The real current line number.
@@ -152,12 +169,12 @@ module Tilia
152
169
  # In the case of unfolded lines, this property holds the line number for
153
170
  # the start of the line.
154
171
  #
155
- # @var int
172
+ # @return [Fixnum]
156
173
  # RUBY: attr_accessor :start_line
157
174
 
158
175
  # Contains a 'raw' representation of the current line.
159
176
  #
160
- # @var string
177
+ # @return [String]
161
178
  # RUBY: attr_accessor :raw_line
162
179
 
163
180
  # Reads a single line from the buffer.
@@ -166,7 +183,7 @@ module Tilia
166
183
  #
167
184
  # @throws \Sabre\VObject\EofException
168
185
  #
169
- # @return string
186
+ # @return [String]
170
187
  def read_line
171
188
  if !@line_buffer.nil?
172
189
  raw_line = @line_buffer
@@ -218,9 +235,9 @@ module Tilia
218
235
 
219
236
  # Reads a property or component from a line.
220
237
  #
221
- # @return void
238
+ # @return [Property]
222
239
  def read_property(line)
223
- if @options & self.class::OPTION_FORGIVING > 0
240
+ if @options & OPTION_FORGIVING > 0
224
241
  prop_name_token = 'A-Z0-9\\-\\._\\/'
225
242
  else
226
243
  prop_name_token = 'A-Z0-9\\-\\.'
@@ -243,6 +260,9 @@ module Tilia
243
260
  ) (?=[;:,])
244
261
  /xi
245
262
 
263
+ # RUBY: We have to convert the string to UTF-8 for Regexp
264
+ encoding = StringUtil.guess_encoding(line)
265
+ line = line.encode(encoding, encoding)
246
266
  matches = line.scan(regex)
247
267
 
248
268
  property = {
@@ -311,9 +331,8 @@ module Tilia
311
331
 
312
332
  property['value'] = '' if property['value'].nil?
313
333
  if property['name'].blank?
314
- if @options & self.class::OPTION_IGNORE_INVALID_LINES > 0
315
- return false
316
- end
334
+ return false if @options & OPTION_IGNORE_INVALID_LINES > 0
335
+
317
336
  fail Tilia::VObject::ParseException, "Invalid Mimedir file. Line starting at #{@start_line} did not follow iCalendar/vCard conventions"
318
337
  end
319
338
 
@@ -342,14 +361,27 @@ module Tilia
342
361
  if prop_obj.key?('ENCODING') && prop_obj['ENCODING'].to_s.upcase == 'QUOTED-PRINTABLE'
343
362
  prop_obj.quoted_printable_value = extract_quoted_printable_value
344
363
  else
364
+ charset = @charset
365
+ if @root.document_type == Document::VCARD21 && prop_obj.key?('CHARSET')
366
+ # vCard 2.1 allows the character set to be specified per property.
367
+ charset = prop_obj['CHARSET'].to_s
368
+ end
369
+
370
+ case charset
371
+ when 'UTF-8'
372
+ # NOOP
373
+ when 'ISO-8859-1',
374
+ 'Windows-1252'
375
+ property['value'] = property['value'].to_s.encode('UTF-8', charset)
376
+ else
377
+ fail ParseException, "Unsupported CHARSET: #{charset}"
378
+ end
345
379
  prop_obj.raw_mime_dir_value = property['value']
346
380
  end
347
381
 
348
382
  prop_obj
349
383
  end
350
384
 
351
- public
352
-
353
385
  # Unescapes a property value.
354
386
  #
355
387
  # vCard 2.1 says:
@@ -406,10 +438,10 @@ module Tilia
406
438
  # If it's a comma or a semi-colon the string will be split on those
407
439
  # characters, and always return an array.
408
440
  #
409
- # @param string input
410
- # @param string delimiter
441
+ # @param [String] input
442
+ # @param [String] delimiter
411
443
  #
412
- # @return string|string[]
444
+ # @return [String|Array<String>]
413
445
  def self.unescape_value(input, delimiter = ';')
414
446
  regex = '(?: (\\\\ (?: \\\\ | N | n | ; | , ) )'
415
447
  regex += ' | (' + delimiter + ')' unless delimiter.blank?
@@ -474,9 +506,9 @@ module Tilia
474
506
  # * ^ is encoded as ^^.
475
507
  # * " is encoded as ^'
476
508
  #
477
- # @param string input
509
+ # @param [String] input
478
510
  #
479
- # @return void
511
+ # @return [String]
480
512
  def unescape_param(input)
481
513
  input.gsub(/(\^(\^|n|\'))/) do |match|
482
514
  case match
@@ -497,7 +529,7 @@ module Tilia
497
529
  #
498
530
  # This method does not do any decoding.
499
531
  #
500
- # @return string
532
+ # @return [String]
501
533
  def extract_quoted_printable_value
502
534
  # We need to parse the raw line again to get the start of the value.
503
535
  #
@@ -520,7 +552,7 @@ module Tilia
520
552
  # Microsoft products don't always correctly fold lines, they may be
521
553
  # missing a whitespace. So if 'forgiving' is turned on, we will take
522
554
  # those as well.
523
- if @options & self.class::OPTION_FORGIVING > 0
555
+ if @options & OPTION_FORGIVING > 0
524
556
  while value[-1] == '='
525
557
  # Reading the line
526
558
  read_line
@@ -532,10 +564,12 @@ module Tilia
532
564
  value
533
565
  end
534
566
 
567
+ # Initialize instance variables
535
568
  def initialize(*args)
536
569
  super(*args)
537
570
  @start_line = 0
538
571
  @line_index = 0
572
+ @charset = 'UTF-8'
539
573
  end
540
574
  end
541
575
  end
@@ -16,19 +16,14 @@ module Tilia
16
16
  # by the reader.
17
17
  OPTION_IGNORE_INVALID_LINES = 2
18
18
 
19
- # Bitmask of parser options.
20
- #
21
- # @var int
22
- # RUBY: attr_accessor :options
23
-
24
19
  # Creates the parser.
25
20
  #
26
21
  # Optionally, it's possible to parse the input stream here.
27
22
  #
28
- # @param mixed input
29
- # @param int options Any parser options (OPTION constants).
23
+ # @param input
24
+ # @param [Fixnum] options Any parser options (OPTION constants).
30
25
  #
31
- # @return void
26
+ # @return [void]
32
27
  def initialize(input = nil, options = 0)
33
28
  self.input = input unless input.nil?
34
29
  @options = options
@@ -41,18 +36,18 @@ module Tilia
41
36
  #
42
37
  # If either input or options are not supplied, the defaults will be used.
43
38
  #
44
- # @param mixed input
45
- # @param int options
39
+ # @param input
40
+ # @param [Fixnum] options
46
41
  #
47
- # @return array
48
- def parse(_input = nil, _options = 0)
42
+ # @return [Document]
43
+ def parse(input = nil, options = 0)
49
44
  end
50
45
 
51
46
  # Sets the input data.
52
47
  #
53
- # @param mixed input
48
+ # @param input
54
49
  #
55
- # @return void
50
+ # @return [void]
56
51
  def input=(_input)
57
52
  end
58
53
  end
@@ -10,47 +10,32 @@ module Tilia
10
10
  XCAL_NAMESPACE = 'urn:ietf:params:xml:ns:icalendar-2.0'
11
11
  XCARD_NAMESPACE = 'urn:ietf:params:xml:ns:vcard-4.0'
12
12
 
13
- # The input data.
14
- #
15
- # @var array
16
- # RUBY: attr_accessor :input
17
-
18
- # A pointer/reference to the input.
19
- #
20
- # @var array
21
- # RUBY: attr_accessor :pointer
22
-
23
- # Document, root component.
24
- #
25
- # @var Sabre\VObject\Document
26
- # RUBY: attr_accessor :root
27
-
28
13
  # Creates the parser.
29
14
  #
30
15
  # Optionally, it's possible to parse the input stream here.
31
16
  #
32
- # @param mixed input
33
- # @param int options Any parser options (OPTION constants).
17
+ # @param input
18
+ # @param [Fixnum] options Any parser options (OPTION constants).
34
19
  #
35
- # @return void
20
+ # @return [void]
36
21
  def initialize(input = nil, options = 0)
37
22
  @input = nil
38
23
  @pointer = nil
39
24
  @root = nil
40
25
 
41
- options = self.class::OPTION_FORGIVING if options == 0
26
+ options = OPTION_FORGIVING if options == 0
42
27
 
43
28
  super(input, options)
44
29
  end
45
30
 
46
31
  # Parse xCal or xCard.
47
32
  #
48
- # @param resource|string input
49
- # @param int options
33
+ # @param [String, IO] input
34
+ # @param [Fixnum] options
50
35
  #
51
- # @throws \Exception
36
+ # @fails [StandardError]
52
37
  #
53
- # @return Sabre\VObject\Document
38
+ # @return [Document]
54
39
  def parse(input = nil, options = 0)
55
40
  self.input = input unless input.nil?
56
41
  @options = options if options != 0
@@ -59,11 +44,11 @@ module Tilia
59
44
  end
60
45
 
61
46
  case @input['name']
62
- when "{#{self.class::XCAL_NAMESPACE}}icalendar"
47
+ when "{#{XCAL_NAMESPACE}}icalendar"
63
48
  @root = Tilia::VObject::Component::VCalendar.new({}, false)
64
49
  @pointer = @input['value'][0]
65
50
  parse_v_calendar_components(@root)
66
- when "{#{self.class::XCARD_NAMESPACE}}vcards"
51
+ when "{#{XCARD_NAMESPACE}}vcards"
67
52
  @input['value'].each do |v_card|
68
53
  @root = Tilia::VObject::Component::VCard.new({ 'version' => '4.0' }, false)
69
54
  @pointer = v_card
@@ -83,9 +68,9 @@ module Tilia
83
68
 
84
69
  # Parse a xCalendar component.
85
70
  #
86
- # @param Component parent_component
71
+ # @param [Component] parent_component
87
72
  #
88
- # @return void
73
+ # @return [void]
89
74
  def parse_v_calendar_components(parent_component)
90
75
  components = @pointer['value'] ? @pointer['value'] : []
91
76
 
@@ -103,9 +88,9 @@ module Tilia
103
88
 
104
89
  # Parse a xCard component.
105
90
  #
106
- # @param Component parent_component
91
+ # @param [Component] parent_component
107
92
  #
108
- # @return void
93
+ # @return [void]
109
94
  def parse_v_card_components(parent_component)
110
95
  @pointer = @pointer['value']
111
96
  parse_properties(parent_component)
@@ -113,10 +98,10 @@ module Tilia
113
98
 
114
99
  # Parse xCalendar and xCard properties.
115
100
  #
116
- # @param Component parent_component
117
- # @param string property_name_prefix
101
+ # @param [Component] parent_component
102
+ # @param [String] property_name_prefix
118
103
  #
119
- # @return void
104
+ # @return [void]
120
105
  def parse_properties(parent_component, property_name_prefix = '')
121
106
  properties = @pointer ? @pointer : {}
122
107
 
@@ -233,8 +218,8 @@ module Tilia
233
218
  property_type = self.class.tag_name(xml_property['value'][0]['name'])
234
219
 
235
220
  property_value ||= []
236
- xml_property['value'].each do |value|
237
- property_value << value['value']
221
+ xml_property['value'].each do |v|
222
+ property_value << v['value']
238
223
  end
239
224
 
240
225
  property_parameters['value'] = 'DATE' if 'date' == property_type
@@ -252,9 +237,9 @@ module Tilia
252
237
 
253
238
  # Parse a component.
254
239
  #
255
- # @param Component parent_component
240
+ # @param [Component] parent_component
256
241
  #
257
- # @return void
242
+ # @return [void]
258
243
  def parse_component(parent_component)
259
244
  components = @pointer['value'] ? @pointer['value'] : []
260
245
 
@@ -271,13 +256,13 @@ module Tilia
271
256
 
272
257
  # Create a property.
273
258
  #
274
- # @param Component parent_component
275
- # @param string name
276
- # @param array parameters
277
- # @param string type
278
- # @param mixed value
259
+ # @param [Component] parent_component
260
+ # @param [String] name
261
+ # @param [array] parameters
262
+ # @param [String] type
263
+ # @param value
279
264
  #
280
- # @return void
265
+ # @return [void]
281
266
  def create_property(parent_component, name, parameters, type, value)
282
267
  property = @root.create_property(name, nil, parameters, type)
283
268
  parent_component.add(property)
@@ -288,16 +273,16 @@ module Tilia
288
273
 
289
274
  # Sets the input data.
290
275
  #
291
- # @param resource|string input
276
+ # @param [resource|string] input
292
277
  #
293
- # @return void
278
+ # @return [void]
294
279
  def input=(input)
295
280
  input = input.read unless input.is_a?(String)
296
281
 
297
282
  if input.is_a?(String)
298
283
  reader = Tilia::Xml::Reader.new
299
- reader.element_map["{#{self.class::XCAL_NAMESPACE}}period"] = Tilia::VObject::Parser::Xml::Element::KeyValue
300
- reader.element_map["{#{self.class::XCAL_NAMESPACE}}recur"] = Tilia::VObject::Parser::Xml::Element::KeyValue
284
+ reader.element_map["{#{XCAL_NAMESPACE}}period"] = Tilia::VObject::Parser::Xml::Element::KeyValue
285
+ reader.element_map["{#{XCAL_NAMESPACE}}recur"] = Tilia::VObject::Parser::Xml::Element::KeyValue
301
286
  reader.xml(input)
302
287
  input = reader.parse
303
288
  end
@@ -305,13 +290,11 @@ module Tilia
305
290
  @input = input
306
291
  end
307
292
 
308
- protected
309
-
310
293
  # Get tag name from a Clark notation.
311
294
  #
312
- # @param string clarked_tag_name
295
+ # @param [String] clarked_tag_name
313
296
  #
314
- # @return string
297
+ # @return [String]
315
298
  def self.tag_name(clarked_tag_name)
316
299
  (_, tag_name) = Tilia::Xml::Service.parse_clark_notation(clarked_tag_name)
317
300
  tag_name