icalendar 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. data/History.txt +3 -0
  2. data/Manifest.txt +61 -0
  3. data/PostInstall.txt +5 -0
  4. data/{README → README.rdoc} +4 -0
  5. data/Rakefile +28 -133
  6. data/config/website.yml +2 -0
  7. data/icalendar.gemspec +55 -0
  8. data/lib/icalendar/base.rb +2 -0
  9. data/lib/icalendar/component.rb +9 -7
  10. data/script/console +10 -0
  11. data/script/destroy +14 -0
  12. data/script/generate +14 -0
  13. data/script/recur1.ics +38 -0
  14. data/script/tryit.rb +13 -0
  15. data/script/txt2html +71 -0
  16. data/test.ical +33 -0
  17. data/test.ics +33 -0
  18. data/test.rb +48 -0
  19. data/test/component/{event_test.rb → test_event.rb} +0 -0
  20. data/test/component/{timezone_test.rb → test_timezone.rb} +1 -1
  21. data/test/component/{todo_test.rb → test_todo.rb} +0 -0
  22. data/test/fixtures/folding.ics +7 -7
  23. data/test/{calendar_test.rb → test_calendar.rb} +1 -4
  24. data/test/{component_test.rb → test_component.rb} +0 -0
  25. data/test/{conversions_test.rb → test_conversions.rb} +8 -8
  26. data/test/test_helper.rb +3 -0
  27. data/test/{parameter_test.rb → test_parameter.rb} +4 -0
  28. data/test/{parser_test.rb → test_parser.rb} +0 -0
  29. data/test2.rb +28 -0
  30. data/website/index.html +11 -0
  31. data/website/index.txt +79 -0
  32. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  33. data/website/stylesheets/screen.css +159 -0
  34. data/website/template.html.erb +50 -0
  35. metadata +135 -135
  36. data/docs/api/classes/Array.html +0 -155
  37. data/docs/api/classes/Bignum.html +0 -148
  38. data/docs/api/classes/Date.html +0 -172
  39. data/docs/api/classes/DateTime.html +0 -200
  40. data/docs/api/classes/Fixnum.html +0 -148
  41. data/docs/api/classes/Float.html +0 -148
  42. data/docs/api/classes/HashAttrs.html +0 -212
  43. data/docs/api/classes/Icalendar/Alarm.html +0 -228
  44. data/docs/api/classes/Icalendar/Base.html +0 -179
  45. data/docs/api/classes/Icalendar/Calendar.html +0 -504
  46. data/docs/api/classes/Icalendar/Component.html +0 -853
  47. data/docs/api/classes/Icalendar/DateProp.html +0 -187
  48. data/docs/api/classes/Icalendar/DateProp/ClassMethods.html +0 -195
  49. data/docs/api/classes/Icalendar/Daylight.html +0 -156
  50. data/docs/api/classes/Icalendar/Event.html +0 -671
  51. data/docs/api/classes/Icalendar/Freebusy.html +0 -266
  52. data/docs/api/classes/Icalendar/Geo.html +0 -211
  53. data/docs/api/classes/Icalendar/InvalidPropertyValue.html +0 -117
  54. data/docs/api/classes/Icalendar/Journal.html +0 -443
  55. data/docs/api/classes/Icalendar/Parameter.html +0 -166
  56. data/docs/api/classes/Icalendar/Parser.html +0 -352
  57. data/docs/api/classes/Icalendar/RRule.html +0 -428
  58. data/docs/api/classes/Icalendar/RRule/Weekday.html +0 -199
  59. data/docs/api/classes/Icalendar/Standard.html +0 -156
  60. data/docs/api/classes/Icalendar/Timezone.html +0 -450
  61. data/docs/api/classes/Icalendar/Todo.html +0 -480
  62. data/docs/api/classes/Icalendar/TzidSupport.html +0 -118
  63. data/docs/api/classes/Icalendar/UnknownComponentClass.html +0 -117
  64. data/docs/api/classes/Icalendar/UnknownPropertyMethod.html +0 -117
  65. data/docs/api/classes/Object.html +0 -272
  66. data/docs/api/classes/String.html +0 -148
  67. data/docs/api/classes/TZInfo.html +0 -119
  68. data/docs/api/classes/TZInfo/Timezone.html +0 -153
  69. data/docs/api/classes/TZInfo/TimezonePeriod.html +0 -200
  70. data/docs/api/classes/TZInfo/TimezoneTransitionInfo.html +0 -229
  71. data/docs/api/classes/Time.html +0 -180
  72. data/docs/api/classes/URI.html +0 -111
  73. data/docs/api/classes/URI/Generic.html +0 -148
  74. data/docs/api/created.rid +0 -1
  75. data/docs/api/files/COPYING.html +0 -163
  76. data/docs/api/files/GPL.html +0 -531
  77. data/docs/api/files/README.html +0 -401
  78. data/docs/api/files/lib/hash_attrs_rb.html +0 -107
  79. data/docs/api/files/lib/icalendar/base_rb.html +0 -108
  80. data/docs/api/files/lib/icalendar/calendar_rb.html +0 -101
  81. data/docs/api/files/lib/icalendar/component/alarm_rb.html +0 -101
  82. data/docs/api/files/lib/icalendar/component/event_rb.html +0 -101
  83. data/docs/api/files/lib/icalendar/component/freebusy_rb.html +0 -101
  84. data/docs/api/files/lib/icalendar/component/journal_rb.html +0 -101
  85. data/docs/api/files/lib/icalendar/component/timezone_rb.html +0 -101
  86. data/docs/api/files/lib/icalendar/component/todo_rb.html +0 -101
  87. data/docs/api/files/lib/icalendar/component_rb.html +0 -108
  88. data/docs/api/files/lib/icalendar/conversions_rb.html +0 -109
  89. data/docs/api/files/lib/icalendar/helpers_rb.html +0 -101
  90. data/docs/api/files/lib/icalendar/parameter_rb.html +0 -101
  91. data/docs/api/files/lib/icalendar/parser_rb.html +0 -110
  92. data/docs/api/files/lib/icalendar/rrule_rb.html +0 -110
  93. data/docs/api/files/lib/icalendar/tzinfo_rb.html +0 -101
  94. data/docs/api/files/lib/icalendar_rb.html +0 -121
  95. data/docs/api/files/lib/meta_rb.html +0 -107
  96. data/docs/api/fr_class_index.html +0 -64
  97. data/docs/api/fr_file_index.html +0 -47
  98. data/docs/api/fr_method_index.html +0 -123
  99. data/docs/api/index.html +0 -24
  100. data/docs/api/rdoc-style.css +0 -208
  101. data/docs/rfcs/itip_notes.txt +0 -69
  102. data/docs/rfcs/rfc2425.pdf +0 -0
  103. data/docs/rfcs/rfc2426.pdf +0 -0
  104. data/docs/rfcs/rfc2445.pdf +0 -0
  105. data/docs/rfcs/rfc2446.pdf +0 -0
  106. data/docs/rfcs/rfc2447.pdf +0 -0
  107. data/docs/rfcs/rfc3283.txt +0 -738
  108. data/test/coverage/STUB +0 -0
  109. data/test/coverage/index.html +0 -272
  110. data/test/coverage/lib-hash_attrs_rb.html +0 -235
  111. data/test/coverage/lib-icalendar-base_rb.html +0 -249
  112. data/test/coverage/lib-icalendar-calendar_rb.html +0 -324
  113. data/test/coverage/lib-icalendar-component-alarm_rb.html +0 -250
  114. data/test/coverage/lib-icalendar-component-event_rb.html +0 -353
  115. data/test/coverage/lib-icalendar-component-freebusy_rb.html +0 -245
  116. data/test/coverage/lib-icalendar-component-journal_rb.html +0 -278
  117. data/test/coverage/lib-icalendar-component-timezone_rb.html +0 -326
  118. data/test/coverage/lib-icalendar-component-todo_rb.html +0 -277
  119. data/test/coverage/lib-icalendar-component_rb.html +0 -733
  120. data/test/coverage/lib-icalendar-conversions_rb.html +0 -358
  121. data/test/coverage/lib-icalendar-parser_rb.html +0 -671
  122. data/test/coverage/lib-icalendar-rrule_rb.html +0 -357
  123. data/test/coverage/lib-icalendar_rb.html +0 -243
  124. data/test/coverage/lib-meta_rb.html +0 -234
@@ -1,358 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
3
- <head>
4
- <title>
5
- lib/icalendar/conversions.rb - C0 code coverage information
6
- </title>
7
- <style type='text/css'>
8
- body { background-color: rgb(240, 240, 245); }
9
- </style>
10
- <style type='text/css'>
11
- span.cross-ref-title { font-size: 140%; } span.cross-ref a {
12
- text-decoration: none; } span.cross-ref { background-color:#f3f7fa;
13
- border: 1px dashed #333; margin: 1em; padding: 0.5em; overflow: hidden; }
14
- a.crossref-toggle { text-decoration: none; } span.marked0 {
15
- background-color: rgb(185, 210, 200); display: block; } span.marked1 {
16
- background-color: rgb(190, 215, 205); display: block; } span.inferred0 {
17
- background-color: rgb(175, 200, 200); display: block; } span.inferred1 {
18
- background-color: rgb(180, 205, 205); display: block; } span.uncovered0 {
19
- background-color: rgb(225, 110, 110); display: block; } span.uncovered1 {
20
- background-color: rgb(235, 120, 120); display: block; } span.overview {
21
- border-bottom: 8px solid black; } div.overview { border-bottom: 8px solid
22
- black; } body { font-family: verdana, arial, helvetica; } div.footer {
23
- font-size: 68%; margin-top: 1.5em; } h1, h2, h3, h4, h5, h6 {
24
- margin-bottom: 0.5em; } h5 { margin-top: 0.5em; } .hidden { display: none;
25
- } div.separator { height: 10px; } /* Commented out for better readability,
26
- esp. on IE */ /* table tr td, table tr th { font-size: 68%; } td.value
27
- table tr td { font-size: 11px; } */ table.percent_graph { height: 12px;
28
- border: #808080 1px solid; empty-cells: show; } table.percent_graph
29
- td.covered { height: 10px; background: #00f000; } table.percent_graph
30
- td.uncovered { height: 10px; background: #e00000; } table.percent_graph
31
- td.NA { height: 10px; background: #eaeaea; } table.report {
32
- border-collapse: collapse; width: 100%; } table.report td.heading {
33
- background: #dcecff; border: #d0d0d0 1px solid; font-weight: bold;
34
- text-align: center; } table.report td.heading:hover { background: #c0ffc0;
35
- } table.report td.text { border: #d0d0d0 1px solid; } table.report
36
- td.value, table.report td.lines_total, table.report td.lines_code {
37
- text-align: right; border: #d0d0d0 1px solid; } table.report tr.light {
38
- background-color: rgb(240, 240, 245); } table.report tr.dark {
39
- background-color: rgb(230, 230, 235); }
40
- </style>
41
- <script type='text/javascript'>
42
- // <![CDATA[ function toggleCode( id ) { if ( document.getElementById )
43
- elem = document.getElementById( id ); else if ( document.all ) elem =
44
- eval( "document.all." + id ); else return false; elemStyle = elem.style;
45
- if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else {
46
- elemStyle.display = "none" } return true; } // Make cross-references
47
- hidden by default document.writeln( "<style
48
- type=\"text/css\">span.cross-ref { display: none }</style>" ) // ]]>
49
- </script>
50
- <style type='text/css'>
51
- span.run0 { background-color: rgb(178, 204, 255); display: block; }
52
- span.run1 { background-color: rgb(178, 206, 255); display: block; }
53
- span.run2 { background-color: rgb(178, 209, 255); display: block; }
54
- span.run3 { background-color: rgb(178, 211, 255); display: block; }
55
- span.run4 { background-color: rgb(178, 214, 255); display: block; }
56
- span.run5 { background-color: rgb(178, 218, 255); display: block; }
57
- span.run6 { background-color: rgb(178, 220, 255); display: block; }
58
- span.run7 { background-color: rgb(178, 223, 255); display: block; }
59
- span.run8 { background-color: rgb(178, 225, 255); display: block; }
60
- span.run9 { background-color: rgb(178, 228, 255); display: block; }
61
- span.run10 { background-color: rgb(178, 232, 255); display: block; }
62
- span.run11 { background-color: rgb(178, 234, 255); display: block; }
63
- span.run12 { background-color: rgb(178, 237, 255); display: block; }
64
- span.run13 { background-color: rgb(178, 239, 255); display: block; }
65
- span.run14 { background-color: rgb(178, 242, 255); display: block; }
66
- span.run15 { background-color: rgb(178, 246, 255); display: block; }
67
- span.run16 { background-color: rgb(178, 248, 255); display: block; }
68
- span.run17 { background-color: rgb(178, 251, 255); display: block; }
69
- span.run18 { background-color: rgb(178, 253, 255); display: block; }
70
- span.run19 { background-color: rgb(178, 255, 253); display: block; }
71
- span.run20 { background-color: rgb(178, 255, 249); display: block; }
72
- span.run21 { background-color: rgb(178, 255, 247); display: block; }
73
- span.run22 { background-color: rgb(178, 255, 244); display: block; }
74
- span.run23 { background-color: rgb(178, 255, 242); display: block; }
75
- span.run24 { background-color: rgb(178, 255, 239); display: block; }
76
- span.run25 { background-color: rgb(178, 255, 235); display: block; }
77
- span.run26 { background-color: rgb(178, 255, 233); display: block; }
78
- span.run27 { background-color: rgb(178, 255, 230); display: block; }
79
- span.run28 { background-color: rgb(178, 255, 228); display: block; }
80
- span.run29 { background-color: rgb(178, 255, 225); display: block; }
81
- span.run30 { background-color: rgb(178, 255, 221); display: block; }
82
- span.run31 { background-color: rgb(178, 255, 219); display: block; }
83
- span.run32 { background-color: rgb(178, 255, 216); display: block; }
84
- span.run33 { background-color: rgb(178, 255, 214); display: block; }
85
- span.run34 { background-color: rgb(178, 255, 211); display: block; }
86
- span.run35 { background-color: rgb(178, 255, 207); display: block; }
87
- span.run36 { background-color: rgb(178, 255, 205); display: block; }
88
- span.run37 { background-color: rgb(178, 255, 202); display: block; }
89
- span.run38 { background-color: rgb(178, 255, 200); display: block; }
90
- span.run39 { background-color: rgb(178, 255, 197); display: block; }
91
- span.run40 { background-color: rgb(178, 255, 193); display: block; }
92
- span.run41 { background-color: rgb(178, 255, 191); display: block; }
93
- span.run42 { background-color: rgb(178, 255, 188); display: block; }
94
- span.run43 { background-color: rgb(178, 255, 186); display: block; }
95
- span.run44 { background-color: rgb(178, 255, 183); display: block; }
96
- span.run45 { background-color: rgb(178, 255, 179); display: block; }
97
- span.run46 { background-color: rgb(179, 255, 178); display: block; }
98
- span.run47 { background-color: rgb(182, 255, 178); display: block; }
99
- span.run48 { background-color: rgb(184, 255, 178); display: block; }
100
- span.run49 { background-color: rgb(187, 255, 178); display: block; }
101
- span.run50 { background-color: rgb(191, 255, 178); display: block; }
102
- span.run51 { background-color: rgb(193, 255, 178); display: block; }
103
- span.run52 { background-color: rgb(196, 255, 178); display: block; }
104
- span.run53 { background-color: rgb(198, 255, 178); display: block; }
105
- span.run54 { background-color: rgb(201, 255, 178); display: block; }
106
- span.run55 { background-color: rgb(205, 255, 178); display: block; }
107
- span.run56 { background-color: rgb(207, 255, 178); display: block; }
108
- span.run57 { background-color: rgb(210, 255, 178); display: block; }
109
- span.run58 { background-color: rgb(212, 255, 178); display: block; }
110
- span.run59 { background-color: rgb(215, 255, 178); display: block; }
111
- span.run60 { background-color: rgb(219, 255, 178); display: block; }
112
- span.run61 { background-color: rgb(221, 255, 178); display: block; }
113
- span.run62 { background-color: rgb(224, 255, 178); display: block; }
114
- span.run63 { background-color: rgb(226, 255, 178); display: block; }
115
- span.run64 { background-color: rgb(229, 255, 178); display: block; }
116
- span.run65 { background-color: rgb(233, 255, 178); display: block; }
117
- span.run66 { background-color: rgb(235, 255, 178); display: block; }
118
- span.run67 { background-color: rgb(238, 255, 178); display: block; }
119
- span.run68 { background-color: rgb(240, 255, 178); display: block; }
120
- span.run69 { background-color: rgb(243, 255, 178); display: block; }
121
- span.run70 { background-color: rgb(247, 255, 178); display: block; }
122
- span.run71 { background-color: rgb(249, 255, 178); display: block; }
123
- span.run72 { background-color: rgb(252, 255, 178); display: block; }
124
- span.run73 { background-color: rgb(255, 255, 178); display: block; }
125
- span.run74 { background-color: rgb(255, 252, 178); display: block; }
126
- span.run75 { background-color: rgb(255, 248, 178); display: block; }
127
- span.run76 { background-color: rgb(255, 246, 178); display: block; }
128
- span.run77 { background-color: rgb(255, 243, 178); display: block; }
129
- span.run78 { background-color: rgb(255, 240, 178); display: block; }
130
- span.run79 { background-color: rgb(255, 238, 178); display: block; }
131
- span.run80 { background-color: rgb(255, 234, 178); display: block; }
132
- span.run81 { background-color: rgb(255, 232, 178); display: block; }
133
- span.run82 { background-color: rgb(255, 229, 178); display: block; }
134
- span.run83 { background-color: rgb(255, 226, 178); display: block; }
135
- span.run84 { background-color: rgb(255, 224, 178); display: block; }
136
- span.run85 { background-color: rgb(255, 220, 178); display: block; }
137
- span.run86 { background-color: rgb(255, 218, 178); display: block; }
138
- span.run87 { background-color: rgb(255, 215, 178); display: block; }
139
- span.run88 { background-color: rgb(255, 212, 178); display: block; }
140
- span.run89 { background-color: rgb(255, 210, 178); display: block; }
141
- span.run90 { background-color: rgb(255, 206, 178); display: block; }
142
- span.run91 { background-color: rgb(255, 204, 178); display: block; }
143
- span.run92 { background-color: rgb(255, 201, 178); display: block; }
144
- span.run93 { background-color: rgb(255, 198, 178); display: block; }
145
- span.run94 { background-color: rgb(255, 196, 178); display: block; }
146
- span.run95 { background-color: rgb(255, 192, 178); display: block; }
147
- span.run96 { background-color: rgb(255, 189, 178); display: block; }
148
- span.run97 { background-color: rgb(255, 187, 178); display: block; }
149
- span.run98 { background-color: rgb(255, 184, 178); display: block; }
150
- span.run99 { background-color: rgb(255, 182, 178); display: block; }
151
- span.run100 { background-color: rgb(255, 178, 178); display: block; }
152
- </style>
153
- </head>
154
- <body>
155
- <h3>
156
- C0 code coverage information
157
- </h3>
158
- <p>
159
- Generated on Sun Mar 29 23:07:04 -0400 2009 with
160
- <a href='http://eigenclass.org/hiki/rcov'>
161
- rcov 0.8.1.2
162
- </a>
163
- </p>
164
- <hr />
165
- <pre><span class='marked0'>Code reported as executed by Ruby looks like
166
- this... </span><span class='marked1'>and this: this line is also marked as
167
- covered. </span><span class='inferred0'>Lines considered as run by rcov, but
168
- not reported by Ruby, look like this, </span><span class='inferred1'>and
169
- this: these lines were inferred by rcov (using simple heuristics).
170
- </span><span class='uncovered0'>Finally, here&apos;s a line marked as not
171
- executed. </span></pre>
172
- <table class='report'> <thead> <tr> <td class='heading'> Name </td> <td
173
- class='heading'> Total lines </td> <td class='heading'> Lines of code </td>
174
- <td class='heading'> Total coverage </td> <td class='heading'> Code coverage
175
- </td> </tr> </thead> <tbody> <tr class='light'> <td> <a
176
- href='lib-icalendar-conversions_rb.html'> lib/icalendar/conversions.rb </a>
177
- </td> <td class='lines_total'> <tt> 150 </tt> </td> <td class='lines_code'>
178
- <tt> 89 </tt> </td> <td> <table cellspacing='0' align='right'
179
- cellpadding='0'> <tr> <td> <tt class='coverage_total'> 95.3% </tt> &nbsp;
180
- </td> <td> <table class='percent_graph' cellspacing='0' width='100'
181
- cellpadding='0'> <tr> <td class='covered' width='95' /> <td
182
- class='uncovered' width='5' /> </tr> </table> </td> </tr> </table> </td>
183
- <td> <table cellspacing='0' align='right' cellpadding='0'> <tr> <td> <tt
184
- class='coverage_code'> 92.1% </tt> &nbsp; </td> <td> <table
185
- class='percent_graph' cellspacing='0' width='100' cellpadding='0'> <tr> <td
186
- class='covered' width='92' /> <td class='uncovered' width='8' /> </tr>
187
- </table> </td> </tr> </table> </td> </tr> </tbody> </table><pre><span
188
- class="inferred1"><a name="line1"></a> 1 =begin </span><span
189
- class="inferred0"><a name="line2"></a> 2 Copyright (C) 2005 Jeff Rose
190
- </span><span class="inferred1"><a name="line3"></a> 3 </span><span
191
- class="inferred0"><a name="line4"></a> 4 This library is free software; you
192
- can redistribute it and/or modify it </span><span class="inferred1"><a
193
- name="line5"></a> 5 under the same terms as the ruby language itself, see
194
- the file COPYING for </span><span class="inferred0"><a name="line6"></a> 6
195
- details. </span><span class="inferred1"><a name="line7"></a> 7 =end
196
- </span><span class="inferred0"><a name="line8"></a> 8 </span><span
197
- class="marked1"><a name="line9"></a> 9 require 'date' </span><span
198
- class="inferred0"><a name="line10"></a> 10 </span><span class="inferred1"><a
199
- name="line11"></a> 11 ### Add some to_ical methods to classes </span><span
200
- class="inferred0"><a name="line12"></a> 12 </span><span class="inferred1"><a
201
- name="line13"></a> 13 # class Object </span><span class="inferred0"><a
202
- name="line14"></a> 14 # def to_ical </span><span class="inferred1"><a
203
- name="line15"></a> 15 # raise(NotImplementedError, &quot;This object does
204
- not implement the to_ical method!&quot;) </span><span class="inferred0"><a
205
- name="line16"></a> 16 # end </span><span class="inferred1"><a
206
- name="line17"></a> 17 # end </span><span class="inferred0"><a
207
- name="line18"></a> 18 </span><span class="marked1"><a name="line19"></a> 19
208
- module Icalendar </span><span class="marked0"><a name="line20"></a> 20
209
- module TzidSupport </span><span class="marked1"><a name="line21"></a> 21
210
- attr_accessor :icalendar_tzid </span><span class="inferred0"><a
211
- name="line22"></a> 22 end </span><span class="inferred1"><a
212
- name="line23"></a> 23 end </span><span class="inferred0"><a
213
- name="line24"></a> 24 </span><span class="marked1"><a name="line25"></a> 25
214
- require 'uri/generic' </span><span class="inferred0"><a name="line26"></a>
215
- 26 </span><span class="marked1"><a name="line27"></a> 27 class String
216
- </span><span class="marked0"><a name="line28"></a> 28 def to_ical
217
- </span><span class="marked1"><a name="line29"></a> 29 self </span><span
218
- class="inferred0"><a name="line30"></a> 30 end </span><span
219
- class="inferred1"><a name="line31"></a> 31 end </span><span
220
- class="inferred0"><a name="line32"></a> 32 </span><span class="marked1"><a
221
- name="line33"></a> 33 class Fixnum </span><span class="marked0"><a
222
- name="line34"></a> 34 def to_ical </span><span class="marked1"><a
223
- name="line35"></a> 35 &quot;#{self}&quot; </span><span class="inferred0"><a
224
- name="line36"></a> 36 end </span><span class="inferred1"><a
225
- name="line37"></a> 37 end </span><span class="inferred0"><a
226
- name="line38"></a> 38 </span><span class="marked1"><a name="line39"></a> 39
227
- class Bignum </span><span class="marked0"><a name="line40"></a> 40 def
228
- to_ical </span><span class="uncovered1"><a name="line41"></a> 41
229
- &quot;#{self}&quot; </span><span class="uncovered0"><a name="line42"></a> 42
230
- end </span><span class="uncovered1"><a name="line43"></a> 43 end
231
- </span><span class="inferred0"><a name="line44"></a> 44 </span><span
232
- class="marked1"><a name="line45"></a> 45 class Float </span><span
233
- class="marked0"><a name="line46"></a> 46 def to_ical </span><span
234
- class="marked1"><a name="line47"></a> 47 &quot;#{self}&quot; </span><span
235
- class="inferred0"><a name="line48"></a> 48 end </span><span
236
- class="inferred1"><a name="line49"></a> 49 end </span><span
237
- class="inferred0"><a name="line50"></a> 50 </span><span class="inferred1"><a
238
- name="line51"></a> 51 # From the spec: &quot;Values in a list of values MUST
239
- be separated by a COMMA </span><span class="inferred0"><a name="line52"></a>
240
- 52 # character (US-ASCII decimal 44).&quot; </span><span class="marked1"><a
241
- name="line53"></a> 53 class Array </span><span class="marked0"><a
242
- name="line54"></a> 54 def to_ical </span><span class="marked1"><a
243
- name="line55"></a> 55 map{|elem| elem.to_ical}.join ',' </span><span
244
- class="inferred0"><a name="line56"></a> 56 end </span><span
245
- class="inferred1"><a name="line57"></a> 57 end </span><span
246
- class="inferred0"><a name="line58"></a> 58 </span><span class="marked1"><a
247
- name="line59"></a> 59 module URI </span><span class="marked0"><a
248
- name="line60"></a> 60 class Generic </span><span class="marked1"><a
249
- name="line61"></a> 61 def to_ical </span><span class="marked0"><a
250
- name="line62"></a> 62 &quot;#{self}&quot; </span><span class="inferred1"><a
251
- name="line63"></a> 63 end </span><span class="inferred0"><a
252
- name="line64"></a> 64 end </span><span class="inferred1"><a
253
- name="line65"></a> 65 end </span><span class="inferred0"><a
254
- name="line66"></a> 66 </span><span class="marked1"><a name="line67"></a> 67
255
- class DateTime &lt; Date </span><span class="marked0"><a name="line68"></a>
256
- 68 attr_accessor :ical_params </span><span class="marked1"><a
257
- name="line69"></a> 69 include Icalendar::TzidSupport </span><span
258
- class="inferred0"><a name="line70"></a> 70 </span><span class="marked1"><a
259
- name="line71"></a> 71 def to_ical </span><span class="marked0"><a
260
- name="line72"></a> 72 s = &quot;&quot; </span><span class="inferred1"><a
261
- name="line73"></a> 73 </span><span class="inferred0"><a name="line74"></a>
262
- 74 # 4 digit year </span><span class="marked1"><a name="line75"></a> 75 s
263
- &lt;&lt; self.year.to_s </span><span class="inferred0"><a name="line76"></a>
264
- 76 </span><span class="inferred1"><a name="line77"></a> 77 # Double digit
265
- month </span><span class="marked0"><a name="line78"></a> 78 s &lt;&lt;
266
- &quot;0&quot; unless self.month &gt; 9 </span><span class="marked1"><a
267
- name="line79"></a> 79 s &lt;&lt; self.month.to_s </span><span
268
- class="inferred0"><a name="line80"></a> 80 </span><span class="inferred1"><a
269
- name="line81"></a> 81 # Double digit day </span><span class="marked0"><a
270
- name="line82"></a> 82 s &lt;&lt; &quot;0&quot; unless self.day &gt; 9
271
- </span><span class="marked1"><a name="line83"></a> 83 s &lt;&lt;
272
- self.day.to_s </span><span class="inferred0"><a name="line84"></a> 84
273
- </span><span class="marked1"><a name="line85"></a> 85 s &lt;&lt;
274
- &quot;T&quot; </span><span class="inferred0"><a name="line86"></a> 86
275
- </span><span class="inferred1"><a name="line87"></a> 87 # Double digit hour
276
- </span><span class="marked0"><a name="line88"></a> 88 s &lt;&lt;
277
- &quot;0&quot; unless self.hour &gt; 9 </span><span class="marked1"><a
278
- name="line89"></a> 89 s &lt;&lt; self.hour.to_s </span><span
279
- class="inferred0"><a name="line90"></a> 90 </span><span class="inferred1"><a
280
- name="line91"></a> 91 # Double digit minute </span><span class="marked0"><a
281
- name="line92"></a> 92 s &lt;&lt; &quot;0&quot; unless self.min &gt; 9
282
- </span><span class="marked1"><a name="line93"></a> 93 s &lt;&lt;
283
- self.min.to_s </span><span class="inferred0"><a name="line94"></a> 94
284
- </span><span class="inferred1"><a name="line95"></a> 95 # Double digit
285
- second </span><span class="marked0"><a name="line96"></a> 96 s &lt;&lt;
286
- &quot;0&quot; unless self.sec &gt; 9 </span><span class="marked1"><a
287
- name="line97"></a> 97 s &lt;&lt; self.sec.to_s </span><span
288
- class="inferred0"><a name="line98"></a> 98 </span><span class="inferred1"><a
289
- name="line99"></a> 99 # UTC time gets a Z suffix </span><span
290
- class="marked0"><a name="line100"></a>100 if icalendar_tzid ==
291
- &quot;UTC&quot; </span><span class="uncovered1"><a name="line101"></a>101 s
292
- &lt;&lt; &quot;Z&quot; </span><span class="uncovered0"><a
293
- name="line102"></a>102 end </span><span class="inferred1"><a
294
- name="line103"></a>103 </span><span class="marked0"><a
295
- name="line104"></a>104 s </span><span class="inferred1"><a
296
- name="line105"></a>105 end </span><span class="inferred0"><a
297
- name="line106"></a>106 end </span><span class="inferred1"><a
298
- name="line107"></a>107 </span><span class="marked0"><a
299
- name="line108"></a>108 class Date </span><span class="marked1"><a
300
- name="line109"></a>109 attr_accessor :ical_params </span><span
301
- class="marked0"><a name="line110"></a>110 def to_ical(utc = false)
302
- </span><span class="marked1"><a name="line111"></a>111 s = &quot;&quot;
303
- </span><span class="inferred0"><a name="line112"></a>112 </span><span
304
- class="inferred1"><a name="line113"></a>113 # 4 digit year </span><span
305
- class="marked0"><a name="line114"></a>114 s &lt;&lt; self.year.to_s
306
- </span><span class="inferred1"><a name="line115"></a>115 </span><span
307
- class="inferred0"><a name="line116"></a>116 # Double digit month
308
- </span><span class="marked1"><a name="line117"></a>117 s &lt;&lt;
309
- &quot;0&quot; unless self.month &gt; 9 </span><span class="marked0"><a
310
- name="line118"></a>118 s &lt;&lt; self.month.to_s </span><span
311
- class="inferred1"><a name="line119"></a>119 </span><span
312
- class="inferred0"><a name="line120"></a>120 # Double digit day </span><span
313
- class="marked1"><a name="line121"></a>121 s &lt;&lt; &quot;0&quot; unless
314
- self.day &gt; 9 </span><span class="marked0"><a name="line122"></a>122 s
315
- &lt;&lt; self.day.to_s </span><span class="inferred1"><a
316
- name="line123"></a>123 end </span><span class="inferred0"><a
317
- name="line124"></a>124 end </span><span class="inferred1"><a
318
- name="line125"></a>125 </span><span class="marked0"><a
319
- name="line126"></a>126 class Time </span><span class="marked1"><a
320
- name="line127"></a>127 attr_accessor :ical_params </span><span
321
- class="marked0"><a name="line128"></a>128 def to_ical(utc = false)
322
- </span><span class="marked1"><a name="line129"></a>129 s = &quot;&quot;
323
- </span><span class="inferred0"><a name="line130"></a>130 </span><span
324
- class="inferred1"><a name="line131"></a>131 # Double digit hour </span><span
325
- class="marked0"><a name="line132"></a>132 s &lt;&lt; &quot;0&quot; unless
326
- self.hour &gt; 9 </span><span class="marked1"><a name="line133"></a>133 s
327
- &lt;&lt; self.hour.to_s </span><span class="inferred0"><a
328
- name="line134"></a>134 </span><span class="inferred1"><a
329
- name="line135"></a>135 # Double digit minute </span><span class="marked0"><a
330
- name="line136"></a>136 s &lt;&lt; &quot;0&quot; unless self.min &gt; 9
331
- </span><span class="marked1"><a name="line137"></a>137 s &lt;&lt;
332
- self.min.to_s </span><span class="inferred0"><a name="line138"></a>138
333
- </span><span class="inferred1"><a name="line139"></a>139 # Double digit
334
- second </span><span class="marked0"><a name="line140"></a>140 s &lt;&lt;
335
- &quot;0&quot; unless self.sec &gt; 9 </span><span class="marked1"><a
336
- name="line141"></a>141 s &lt;&lt; self.sec.to_s </span><span
337
- class="inferred0"><a name="line142"></a>142 </span><span
338
- class="inferred1"><a name="line143"></a>143 # UTC time gets a Z suffix
339
- </span><span class="marked0"><a name="line144"></a>144 if utc </span><span
340
- class="uncovered1"><a name="line145"></a>145 s &lt;&lt; &quot;Z&quot;
341
- </span><span class="uncovered0"><a name="line146"></a>146 end </span><span
342
- class="inferred1"><a name="line147"></a>147 </span><span class="marked0"><a
343
- name="line148"></a>148 s </span><span class="inferred1"><a
344
- name="line149"></a>149 end </span><span class="inferred0"><a
345
- name="line150"></a>150 end </span></pre>
346
- <hr />
347
- <p> Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'> rcov
348
- code coverage analysis tool for Ruby </a> version 0.8.1.2. </p>
349
- <p>
350
- <a href='http://validator.w3.org/check/referer'>
351
- <img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88' />
352
- </a>
353
- <a href='http://jigsaw.w3.org/css-validator/check/referer'>
354
- <img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px' />
355
- </a>
356
- </p>
357
- </body>
358
- </html>
@@ -1,671 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
3
- <head>
4
- <title>
5
- lib/icalendar/parser.rb - C0 code coverage information
6
- </title>
7
- <style type='text/css'>
8
- body { background-color: rgb(240, 240, 245); }
9
- </style>
10
- <style type='text/css'>
11
- span.cross-ref-title { font-size: 140%; } span.cross-ref a {
12
- text-decoration: none; } span.cross-ref { background-color:#f3f7fa;
13
- border: 1px dashed #333; margin: 1em; padding: 0.5em; overflow: hidden; }
14
- a.crossref-toggle { text-decoration: none; } span.marked0 {
15
- background-color: rgb(185, 210, 200); display: block; } span.marked1 {
16
- background-color: rgb(190, 215, 205); display: block; } span.inferred0 {
17
- background-color: rgb(175, 200, 200); display: block; } span.inferred1 {
18
- background-color: rgb(180, 205, 205); display: block; } span.uncovered0 {
19
- background-color: rgb(225, 110, 110); display: block; } span.uncovered1 {
20
- background-color: rgb(235, 120, 120); display: block; } span.overview {
21
- border-bottom: 8px solid black; } div.overview { border-bottom: 8px solid
22
- black; } body { font-family: verdana, arial, helvetica; } div.footer {
23
- font-size: 68%; margin-top: 1.5em; } h1, h2, h3, h4, h5, h6 {
24
- margin-bottom: 0.5em; } h5 { margin-top: 0.5em; } .hidden { display: none;
25
- } div.separator { height: 10px; } /* Commented out for better readability,
26
- esp. on IE */ /* table tr td, table tr th { font-size: 68%; } td.value
27
- table tr td { font-size: 11px; } */ table.percent_graph { height: 12px;
28
- border: #808080 1px solid; empty-cells: show; } table.percent_graph
29
- td.covered { height: 10px; background: #00f000; } table.percent_graph
30
- td.uncovered { height: 10px; background: #e00000; } table.percent_graph
31
- td.NA { height: 10px; background: #eaeaea; } table.report {
32
- border-collapse: collapse; width: 100%; } table.report td.heading {
33
- background: #dcecff; border: #d0d0d0 1px solid; font-weight: bold;
34
- text-align: center; } table.report td.heading:hover { background: #c0ffc0;
35
- } table.report td.text { border: #d0d0d0 1px solid; } table.report
36
- td.value, table.report td.lines_total, table.report td.lines_code {
37
- text-align: right; border: #d0d0d0 1px solid; } table.report tr.light {
38
- background-color: rgb(240, 240, 245); } table.report tr.dark {
39
- background-color: rgb(230, 230, 235); }
40
- </style>
41
- <script type='text/javascript'>
42
- // <![CDATA[ function toggleCode( id ) { if ( document.getElementById )
43
- elem = document.getElementById( id ); else if ( document.all ) elem =
44
- eval( "document.all." + id ); else return false; elemStyle = elem.style;
45
- if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else {
46
- elemStyle.display = "none" } return true; } // Make cross-references
47
- hidden by default document.writeln( "<style
48
- type=\"text/css\">span.cross-ref { display: none }</style>" ) // ]]>
49
- </script>
50
- <style type='text/css'>
51
- span.run0 { background-color: rgb(178, 204, 255); display: block; }
52
- span.run1 { background-color: rgb(178, 206, 255); display: block; }
53
- span.run2 { background-color: rgb(178, 209, 255); display: block; }
54
- span.run3 { background-color: rgb(178, 211, 255); display: block; }
55
- span.run4 { background-color: rgb(178, 214, 255); display: block; }
56
- span.run5 { background-color: rgb(178, 218, 255); display: block; }
57
- span.run6 { background-color: rgb(178, 220, 255); display: block; }
58
- span.run7 { background-color: rgb(178, 223, 255); display: block; }
59
- span.run8 { background-color: rgb(178, 225, 255); display: block; }
60
- span.run9 { background-color: rgb(178, 228, 255); display: block; }
61
- span.run10 { background-color: rgb(178, 232, 255); display: block; }
62
- span.run11 { background-color: rgb(178, 234, 255); display: block; }
63
- span.run12 { background-color: rgb(178, 237, 255); display: block; }
64
- span.run13 { background-color: rgb(178, 239, 255); display: block; }
65
- span.run14 { background-color: rgb(178, 242, 255); display: block; }
66
- span.run15 { background-color: rgb(178, 246, 255); display: block; }
67
- span.run16 { background-color: rgb(178, 248, 255); display: block; }
68
- span.run17 { background-color: rgb(178, 251, 255); display: block; }
69
- span.run18 { background-color: rgb(178, 253, 255); display: block; }
70
- span.run19 { background-color: rgb(178, 255, 253); display: block; }
71
- span.run20 { background-color: rgb(178, 255, 249); display: block; }
72
- span.run21 { background-color: rgb(178, 255, 247); display: block; }
73
- span.run22 { background-color: rgb(178, 255, 244); display: block; }
74
- span.run23 { background-color: rgb(178, 255, 242); display: block; }
75
- span.run24 { background-color: rgb(178, 255, 239); display: block; }
76
- span.run25 { background-color: rgb(178, 255, 235); display: block; }
77
- span.run26 { background-color: rgb(178, 255, 233); display: block; }
78
- span.run27 { background-color: rgb(178, 255, 230); display: block; }
79
- span.run28 { background-color: rgb(178, 255, 228); display: block; }
80
- span.run29 { background-color: rgb(178, 255, 225); display: block; }
81
- span.run30 { background-color: rgb(178, 255, 221); display: block; }
82
- span.run31 { background-color: rgb(178, 255, 219); display: block; }
83
- span.run32 { background-color: rgb(178, 255, 216); display: block; }
84
- span.run33 { background-color: rgb(178, 255, 214); display: block; }
85
- span.run34 { background-color: rgb(178, 255, 211); display: block; }
86
- span.run35 { background-color: rgb(178, 255, 207); display: block; }
87
- span.run36 { background-color: rgb(178, 255, 205); display: block; }
88
- span.run37 { background-color: rgb(178, 255, 202); display: block; }
89
- span.run38 { background-color: rgb(178, 255, 200); display: block; }
90
- span.run39 { background-color: rgb(178, 255, 197); display: block; }
91
- span.run40 { background-color: rgb(178, 255, 193); display: block; }
92
- span.run41 { background-color: rgb(178, 255, 191); display: block; }
93
- span.run42 { background-color: rgb(178, 255, 188); display: block; }
94
- span.run43 { background-color: rgb(178, 255, 186); display: block; }
95
- span.run44 { background-color: rgb(178, 255, 183); display: block; }
96
- span.run45 { background-color: rgb(178, 255, 179); display: block; }
97
- span.run46 { background-color: rgb(179, 255, 178); display: block; }
98
- span.run47 { background-color: rgb(182, 255, 178); display: block; }
99
- span.run48 { background-color: rgb(184, 255, 178); display: block; }
100
- span.run49 { background-color: rgb(187, 255, 178); display: block; }
101
- span.run50 { background-color: rgb(191, 255, 178); display: block; }
102
- span.run51 { background-color: rgb(193, 255, 178); display: block; }
103
- span.run52 { background-color: rgb(196, 255, 178); display: block; }
104
- span.run53 { background-color: rgb(198, 255, 178); display: block; }
105
- span.run54 { background-color: rgb(201, 255, 178); display: block; }
106
- span.run55 { background-color: rgb(205, 255, 178); display: block; }
107
- span.run56 { background-color: rgb(207, 255, 178); display: block; }
108
- span.run57 { background-color: rgb(210, 255, 178); display: block; }
109
- span.run58 { background-color: rgb(212, 255, 178); display: block; }
110
- span.run59 { background-color: rgb(215, 255, 178); display: block; }
111
- span.run60 { background-color: rgb(219, 255, 178); display: block; }
112
- span.run61 { background-color: rgb(221, 255, 178); display: block; }
113
- span.run62 { background-color: rgb(224, 255, 178); display: block; }
114
- span.run63 { background-color: rgb(226, 255, 178); display: block; }
115
- span.run64 { background-color: rgb(229, 255, 178); display: block; }
116
- span.run65 { background-color: rgb(233, 255, 178); display: block; }
117
- span.run66 { background-color: rgb(235, 255, 178); display: block; }
118
- span.run67 { background-color: rgb(238, 255, 178); display: block; }
119
- span.run68 { background-color: rgb(240, 255, 178); display: block; }
120
- span.run69 { background-color: rgb(243, 255, 178); display: block; }
121
- span.run70 { background-color: rgb(247, 255, 178); display: block; }
122
- span.run71 { background-color: rgb(249, 255, 178); display: block; }
123
- span.run72 { background-color: rgb(252, 255, 178); display: block; }
124
- span.run73 { background-color: rgb(255, 255, 178); display: block; }
125
- span.run74 { background-color: rgb(255, 252, 178); display: block; }
126
- span.run75 { background-color: rgb(255, 248, 178); display: block; }
127
- span.run76 { background-color: rgb(255, 246, 178); display: block; }
128
- span.run77 { background-color: rgb(255, 243, 178); display: block; }
129
- span.run78 { background-color: rgb(255, 240, 178); display: block; }
130
- span.run79 { background-color: rgb(255, 238, 178); display: block; }
131
- span.run80 { background-color: rgb(255, 234, 178); display: block; }
132
- span.run81 { background-color: rgb(255, 232, 178); display: block; }
133
- span.run82 { background-color: rgb(255, 229, 178); display: block; }
134
- span.run83 { background-color: rgb(255, 226, 178); display: block; }
135
- span.run84 { background-color: rgb(255, 224, 178); display: block; }
136
- span.run85 { background-color: rgb(255, 220, 178); display: block; }
137
- span.run86 { background-color: rgb(255, 218, 178); display: block; }
138
- span.run87 { background-color: rgb(255, 215, 178); display: block; }
139
- span.run88 { background-color: rgb(255, 212, 178); display: block; }
140
- span.run89 { background-color: rgb(255, 210, 178); display: block; }
141
- span.run90 { background-color: rgb(255, 206, 178); display: block; }
142
- span.run91 { background-color: rgb(255, 204, 178); display: block; }
143
- span.run92 { background-color: rgb(255, 201, 178); display: block; }
144
- span.run93 { background-color: rgb(255, 198, 178); display: block; }
145
- span.run94 { background-color: rgb(255, 196, 178); display: block; }
146
- span.run95 { background-color: rgb(255, 192, 178); display: block; }
147
- span.run96 { background-color: rgb(255, 189, 178); display: block; }
148
- span.run97 { background-color: rgb(255, 187, 178); display: block; }
149
- span.run98 { background-color: rgb(255, 184, 178); display: block; }
150
- span.run99 { background-color: rgb(255, 182, 178); display: block; }
151
- span.run100 { background-color: rgb(255, 178, 178); display: block; }
152
- </style>
153
- </head>
154
- <body>
155
- <h3>
156
- C0 code coverage information
157
- </h3>
158
- <p>
159
- Generated on Sun Mar 29 23:07:04 -0400 2009 with
160
- <a href='http://eigenclass.org/hiki/rcov'>
161
- rcov 0.8.1.2
162
- </a>
163
- </p>
164
- <hr />
165
- <pre><span class='marked0'>Code reported as executed by Ruby looks like
166
- this... </span><span class='marked1'>and this: this line is also marked as
167
- covered. </span><span class='inferred0'>Lines considered as run by rcov, but
168
- not reported by Ruby, look like this, </span><span class='inferred1'>and
169
- this: these lines were inferred by rcov (using simple heuristics).
170
- </span><span class='uncovered0'>Finally, here&apos;s a line marked as not
171
- executed. </span></pre>
172
- <table class='report'> <thead> <tr> <td class='heading'> Name </td> <td
173
- class='heading'> Total lines </td> <td class='heading'> Lines of code </td>
174
- <td class='heading'> Total coverage </td> <td class='heading'> Code coverage
175
- </td> </tr> </thead> <tbody> <tr class='light'> <td> <a
176
- href='lib-icalendar-parser_rb.html'> lib/icalendar/parser.rb </a> </td> <td
177
- class='lines_total'> <tt> 396 </tt> </td> <td class='lines_code'> <tt> 249
178
- </tt> </td> <td> <table cellspacing='0' align='right' cellpadding='0'> <tr>
179
- <td> <tt class='coverage_total'> 83.8% </tt> &nbsp; </td> <td> <table
180
- class='percent_graph' cellspacing='0' width='100' cellpadding='0'> <tr> <td
181
- class='covered' width='84' /> <td class='uncovered' width='16' /> </tr>
182
- </table> </td> </tr> </table> </td> <td> <table cellspacing='0'
183
- align='right' cellpadding='0'> <tr> <td> <tt class='coverage_code'> 75.1%
184
- </tt> &nbsp; </td> <td> <table class='percent_graph' cellspacing='0'
185
- width='100' cellpadding='0'> <tr> <td class='covered' width='75' /> <td
186
- class='uncovered' width='25' /> </tr> </table> </td> </tr> </table> </td>
187
- </tr> </tbody> </table><pre><span class="inferred1"><a name="line1"></a> 1
188
- =begin </span><span class="inferred0"><a name="line2"></a> 2 Copyright (C)
189
- 2005 Jeff Rose </span><span class="inferred1"><a name="line3"></a> 3
190
- Copyright (C) 2005 Sam Roberts </span><span class="inferred0"><a
191
- name="line4"></a> 4 </span><span class="inferred1"><a name="line5"></a> 5
192
- This library is free software; you can redistribute it and/or modify it
193
- </span><span class="inferred0"><a name="line6"></a> 6 under the same terms
194
- as the ruby language itself, see the file COPYING for </span><span
195
- class="inferred1"><a name="line7"></a> 7 details. </span><span
196
- class="inferred0"><a name="line8"></a> 8 =end </span><span
197
- class="inferred1"><a name="line9"></a> 9 </span><span class="marked0"><a
198
- name="line10"></a> 10 require 'date' </span><span class="marked1"><a
199
- name="line11"></a> 11 require 'uri' </span><span class="marked0"><a
200
- name="line12"></a> 12 require 'stringio' </span><span class="inferred1"><a
201
- name="line13"></a> 13 </span><span class="marked0"><a name="line14"></a> 14
202
- module Icalendar </span><span class="inferred1"><a name="line15"></a> 15
203
- </span><span class="marked0"><a name="line16"></a> 16 def
204
- Icalendar.parse(src, single = false) </span><span class="marked1"><a
205
- name="line17"></a> 17 cals = Icalendar::Parser.new(src).parse </span><span
206
- class="inferred0"><a name="line18"></a> 18 </span><span class="marked1"><a
207
- name="line19"></a> 19 if single </span><span class="uncovered0"><a
208
- name="line20"></a> 20 cals.first </span><span class="inferred1"><a
209
- name="line21"></a> 21 else </span><span class="marked0"><a
210
- name="line22"></a> 22 cals </span><span class="inferred1"><a
211
- name="line23"></a> 23 end </span><span class="inferred0"><a
212
- name="line24"></a> 24 end </span><span class="inferred1"><a
213
- name="line25"></a> 25 </span><span class="marked0"><a name="line26"></a> 26
214
- class Parser &lt; Icalendar::Base </span><span class="inferred1"><a
215
- name="line27"></a> 27 # date = date-fullyear [&quot;-&quot;] date-month
216
- [&quot;-&quot;] date-mday </span><span class="inferred0"><a
217
- name="line28"></a> 28 # date-fullyear = 4 DIGIT </span><span
218
- class="inferred1"><a name="line29"></a> 29 # date-month = 2 DIGIT
219
- </span><span class="inferred0"><a name="line30"></a> 30 # date-mday = 2
220
- DIGIT </span><span class="marked1"><a name="line31"></a> 31 DATE =
221
- '(\d\d\d\d)-?(\d\d)-?(\d\d)' </span><span class="inferred0"><a
222
- name="line32"></a> 32 </span><span class="inferred1"><a name="line33"></a>
223
- 33 # time = time-hour [&quot;:&quot;] time-minute [&quot;:&quot;]
224
- time-second [time-secfrac] [time-zone] </span><span class="inferred0"><a
225
- name="line34"></a> 34 # time-hour = 2 DIGIT </span><span
226
- class="inferred1"><a name="line35"></a> 35 # time-minute = 2 DIGIT
227
- </span><span class="inferred0"><a name="line36"></a> 36 # time-second = 2
228
- DIGIT </span><span class="inferred1"><a name="line37"></a> 37 # time-secfrac
229
- = &quot;,&quot; 1*DIGIT </span><span class="inferred0"><a name="line38"></a>
230
- 38 # time-zone = &quot;Z&quot; / time-numzone </span><span
231
- class="inferred1"><a name="line39"></a> 39 # time-numzome = sign time-hour
232
- [&quot;:&quot;] time-minute </span><span class="marked0"><a
233
- name="line40"></a> 40 TIME =
234
- '(\d\d):?(\d\d):?(\d\d)(\.\d+)?(Z|[-+]\d\d:?\d\d)?' </span><span
235
- class="inferred1"><a name="line41"></a> 41 </span><span class="marked0"><a
236
- name="line42"></a> 42 def initialize(src) </span><span class="inferred1"><a
237
- name="line43"></a> 43 # Setup the parser method hash table </span><span
238
- class="marked0"><a name="line44"></a> 44 setup_parsers() </span><span
239
- class="inferred1"><a name="line45"></a> 45 </span><span class="marked0"><a
240
- name="line46"></a> 46 if src.respond_to?(:gets) </span><span
241
- class="marked1"><a name="line47"></a> 47 @file = src </span><span
242
- class="marked0"><a name="line48"></a> 48 elsif (not src.nil?) and
243
- src.respond_to?(:to_s) </span><span class="marked1"><a name="line49"></a> 49
244
- @file = StringIO.new(src.to_s, 'r') </span><span class="inferred0"><a
245
- name="line50"></a> 50 else </span><span class="marked1"><a
246
- name="line51"></a> 51 raise ArgumentError, &quot;CalendarParser.new cannot
247
- be called with a #{src.class} type!&quot; </span><span class="inferred0"><a
248
- name="line52"></a> 52 end </span><span class="inferred1"><a
249
- name="line53"></a> 53 </span><span class="marked0"><a name="line54"></a> 54
250
- @prev_line = @file.gets </span><span class="marked1"><a name="line55"></a>
251
- 55 @prev_line.chomp! unless @prev_line.nil? </span><span
252
- class="inferred0"><a name="line56"></a> 56 </span><span class="marked1"><a
253
- name="line57"></a> 57 @@logger.debug(&quot;New Calendar Parser:
254
- #{@file.inspect}&quot;) </span><span class="inferred0"><a name="line58"></a>
255
- 58 end </span><span class="inferred1"><a name="line59"></a> 59 </span><span
256
- class="inferred0"><a name="line60"></a> 60 # Define next line for an IO
257
- object. </span><span class="inferred1"><a name="line61"></a> 61 # Works for
258
- strings now with StringIO </span><span class="marked0"><a name="line62"></a>
259
- 62 def next_line </span><span class="marked1"><a name="line63"></a> 63 line
260
- = @prev_line </span><span class="inferred0"><a name="line64"></a> 64
261
- </span><span class="marked1"><a name="line65"></a> 65 if line.nil?
262
- </span><span class="marked0"><a name="line66"></a> 66 return nil
263
- </span><span class="inferred1"><a name="line67"></a> 67 end </span><span
264
- class="inferred0"><a name="line68"></a> 68 </span><span class="inferred1"><a
265
- name="line69"></a> 69 # Loop through until we get to a non-continuation
266
- line... </span><span class="marked0"><a name="line70"></a> 70 loop do
267
- </span><span class="marked1"><a name="line71"></a> 71 nextLine = @file.gets
268
- </span><span class="marked0"><a name="line72"></a> 72 @@logger.debug
269
- &quot;new_line: #{nextLine}&quot; </span><span class="inferred1"><a
270
- name="line73"></a> 73 </span><span class="marked0"><a name="line74"></a> 74
271
- if !nextLine.nil? </span><span class="marked1"><a name="line75"></a> 75
272
- nextLine.chomp! </span><span class="inferred0"><a name="line76"></a> 76 end
273
- </span><span class="inferred1"><a name="line77"></a> 77 </span><span
274
- class="inferred0"><a name="line78"></a> 78 # If it's a continuation line,
275
- add it to the last. </span><span class="inferred1"><a name="line79"></a> 79
276
- # If it's an empty line, drop it from the input. </span><span
277
- class="marked0"><a name="line80"></a> 80 if( nextLine =~ /^[ \t]/ )
278
- </span><span class="marked1"><a name="line81"></a> 81 line &lt;&lt;
279
- nextLine[1, nextLine.size] </span><span class="marked0"><a
280
- name="line82"></a> 82 elsif( nextLine =~ /^$/ ) </span><span
281
- class="inferred1"><a name="line83"></a> 83 else </span><span
282
- class="marked0"><a name="line84"></a> 84 @prev_line = nextLine </span><span
283
- class="marked1"><a name="line85"></a> 85 break </span><span
284
- class="inferred0"><a name="line86"></a> 86 end </span><span
285
- class="inferred1"><a name="line87"></a> 87 end </span><span
286
- class="marked0"><a name="line88"></a> 88 line </span><span
287
- class="inferred1"><a name="line89"></a> 89 end </span><span
288
- class="inferred0"><a name="line90"></a> 90 </span><span class="inferred1"><a
289
- name="line91"></a> 91 # Parse the calendar into an object representation
290
- </span><span class="marked0"><a name="line92"></a> 92 def parse </span><span
291
- class="marked1"><a name="line93"></a> 93 calendars = [] </span><span
292
- class="inferred0"><a name="line94"></a> 94 </span><span class="marked1"><a
293
- name="line95"></a> 95 @@logger.debug &quot;parsing...&quot; </span><span
294
- class="inferred0"><a name="line96"></a> 96 # Outer loop for Calendar objects
295
- </span><span class="marked1"><a name="line97"></a> 97 while (line =
296
- next_line) </span><span class="marked0"><a name="line98"></a> 98 fields =
297
- parse_line(line) </span><span class="inferred1"><a name="line99"></a> 99
298
- </span><span class="inferred0"><a name="line100"></a>100 # Just iterate
299
- through until we find the beginning of a calendar object </span><span
300
- class="marked1"><a name="line101"></a>101 if fields[:name] ==
301
- &quot;BEGIN&quot; and fields[:value] == &quot;VCALENDAR&quot; </span><span
302
- class="marked0"><a name="line102"></a>102 cal = parse_component </span><span
303
- class="marked1"><a name="line103"></a>103 @@logger.debug &quot;Added parsed
304
- calendar...&quot; </span><span class="marked0"><a name="line104"></a>104
305
- calendars &lt;&lt; cal </span><span class="inferred1"><a
306
- name="line105"></a>105 end </span><span class="inferred0"><a
307
- name="line106"></a>106 end </span><span class="inferred1"><a
308
- name="line107"></a>107 </span><span class="marked0"><a
309
- name="line108"></a>108 calendars </span><span class="inferred1"><a
310
- name="line109"></a>109 end </span><span class="inferred0"><a
311
- name="line110"></a>110 </span><span class="marked1"><a
312
- name="line111"></a>111 private </span><span class="inferred0"><a
313
- name="line112"></a>112 </span><span class="inferred1"><a
314
- name="line113"></a>113 # Parse a single VCALENDAR object </span><span
315
- class="inferred0"><a name="line114"></a>114 # -- This should consist of the
316
- PRODID, VERSION, option METHOD &amp; CALSCALE, </span><span
317
- class="inferred1"><a name="line115"></a>115 # and then one or more calendar
318
- components: VEVENT, VTODO, VJOURNAL, </span><span class="inferred0"><a
319
- name="line116"></a>116 # VFREEBUSY, VTIMEZONE </span><span
320
- class="marked1"><a name="line117"></a>117 def parse_component(component =
321
- Calendar.new) </span><span class="marked0"><a name="line118"></a>118
322
- @@logger.debug &quot;parsing new component...&quot; </span><span
323
- class="inferred1"><a name="line119"></a>119 </span><span class="marked0"><a
324
- name="line120"></a>120 while (line = next_line) </span><span
325
- class="marked1"><a name="line121"></a>121 fields = parse_line(line)
326
- </span><span class="inferred0"><a name="line122"></a>122 </span><span
327
- class="marked1"><a name="line123"></a>123 name = fields[:name].upcase
328
- </span><span class="inferred0"><a name="line124"></a>124 </span><span
329
- class="inferred1"><a name="line125"></a>125 # Although properties are
330
- supposed to come before components, we should </span><span
331
- class="inferred0"><a name="line126"></a>126 # be able to handle them in any
332
- order... </span><span class="marked1"><a name="line127"></a>127 if name ==
333
- &quot;END&quot; </span><span class="marked0"><a name="line128"></a>128 break
334
- </span><span class="marked1"><a name="line129"></a>129 elsif name ==
335
- &quot;BEGIN&quot; # New component </span><span class="marked0"><a
336
- name="line130"></a>130 case(fields[:value]) </span><span class="marked1"><a
337
- name="line131"></a>131 when &quot;VEVENT&quot; # Event </span><span
338
- class="marked0"><a name="line132"></a>132 component.add_component
339
- parse_component(Event.new) </span><span class="uncovered1"><a
340
- name="line133"></a>133 when &quot;VTODO&quot; # Todo entry </span><span
341
- class="uncovered0"><a name="line134"></a>134 component.add_component
342
- parse_component(Todo.new) </span><span class="uncovered1"><a
343
- name="line135"></a>135 when &quot;VALARM&quot; # Alarm sub-component for
344
- event and todo </span><span class="uncovered0"><a name="line136"></a>136
345
- component.add_component parse_component(Alarm.new) </span><span
346
- class="uncovered1"><a name="line137"></a>137 when &quot;VJOURNAL&quot; #
347
- Journal entry </span><span class="uncovered0"><a name="line138"></a>138
348
- component.add_component parse_component(Journal.new) </span><span
349
- class="uncovered1"><a name="line139"></a>139 when &quot;VFREEBUSY&quot; #
350
- Free/Busy section </span><span class="uncovered0"><a name="line140"></a>140
351
- component.add_component parse_component(Freebusy.new) </span><span
352
- class="uncovered1"><a name="line141"></a>141 when &quot;VTIMEZONE&quot; #
353
- Timezone specification </span><span class="uncovered0"><a
354
- name="line142"></a>142 component.add_component parse_component(Timezone.new)
355
- </span><span class="uncovered1"><a name="line143"></a>143 when
356
- &quot;STANDARD&quot; # Standard time sub-component for timezone </span><span
357
- class="uncovered0"><a name="line144"></a>144 component.add_component
358
- parse_component(Standard.new) </span><span class="uncovered1"><a
359
- name="line145"></a>145 when &quot;DAYLIGHT&quot; # Daylight time
360
- sub-component for timezone </span><span class="uncovered0"><a
361
- name="line146"></a>146 component.add_component parse_component(Daylight.new)
362
- </span><span class="uncovered1"><a name="line147"></a>147 else # Uknown
363
- component type, skip to matching end </span><span class="uncovered0"><a
364
- name="line148"></a>148 until ((line = next_line) ==
365
- &quot;END:#{fields[:value]}&quot;); end </span><span class="uncovered1"><a
366
- name="line149"></a>149 next </span><span class="uncovered0"><a
367
- name="line150"></a>150 end </span><span class="inferred1"><a
368
- name="line151"></a>151 else # If its not a component then it should be a
369
- property </span><span class="marked0"><a name="line152"></a>152 params =
370
- fields[:params] </span><span class="marked1"><a name="line153"></a>153 value
371
- = fields[:value] </span><span class="inferred0"><a name="line154"></a>154
372
- </span><span class="inferred1"><a name="line155"></a>155 # Lookup the
373
- property name to see if we have a string to </span><span
374
- class="inferred0"><a name="line156"></a>156 # object parser for this
375
- property type. </span><span class="marked1"><a name="line157"></a>157
376
- orig_value = value </span><span class="marked0"><a name="line158"></a>158 if
377
- @parsers.has_key?(name) </span><span class="marked1"><a
378
- name="line159"></a>159 value = @parsers[name].call(name, params, value)
379
- </span><span class="inferred0"><a name="line160"></a>160 end </span><span
380
- class="inferred1"><a name="line161"></a>161 </span><span class="marked0"><a
381
- name="line162"></a>162 name = name.downcase </span><span
382
- class="inferred1"><a name="line163"></a>163 </span><span
383
- class="inferred0"><a name="line164"></a>164 # TODO: check to see if there
384
- are any more conflicts. </span><span class="marked1"><a
385
- name="line165"></a>165 if name == 'class' or name == 'method' </span><span
386
- class="marked0"><a name="line166"></a>166 name = &quot;ip_&quot; + name
387
- </span><span class="inferred1"><a name="line167"></a>167 end </span><span
388
- class="inferred0"><a name="line168"></a>168 </span><span
389
- class="inferred1"><a name="line169"></a>169 # Replace dashes with
390
- underscores </span><span class="marked0"><a name="line170"></a>170 name =
391
- name.gsub('-', '_') </span><span class="inferred1"><a name="line171"></a>171
392
- </span><span class="marked0"><a name="line172"></a>172 if
393
- component.multi_property?(name) </span><span class="marked1"><a
394
- name="line173"></a>173 adder = &quot;add_&quot; + name </span><span
395
- class="marked0"><a name="line174"></a>174 if component.respond_to?(adder)
396
- </span><span class="marked1"><a name="line175"></a>175 component.send(adder,
397
- value, params) </span><span class="uncovered0"><a name="line176"></a>176
398
- else </span><span class="uncovered1"><a name="line177"></a>177
399
- raise(UnknownPropertyMethod, &quot;Unknown property type: #{adder}&quot;)
400
- </span><span class="uncovered0"><a name="line178"></a>178 end </span><span
401
- class="inferred1"><a name="line179"></a>179 else </span><span
402
- class="marked0"><a name="line180"></a>180 if component.respond_to?(name)
403
- </span><span class="marked1"><a name="line181"></a>181 component.send(name,
404
- value, params) </span><span class="uncovered0"><a name="line182"></a>182
405
- else </span><span class="uncovered1"><a name="line183"></a>183
406
- raise(UnknownPropertyMethod, &quot;Unknown property type: #{name}&quot;)
407
- </span><span class="uncovered0"><a name="line184"></a>184 end </span><span
408
- class="uncovered1"><a name="line185"></a>185 end </span><span
409
- class="uncovered0"><a name="line186"></a>186 end </span><span
410
- class="uncovered1"><a name="line187"></a>187 end </span><span
411
- class="inferred0"><a name="line188"></a>188 </span><span class="marked1"><a
412
- name="line189"></a>189 component </span><span class="inferred0"><a
413
- name="line190"></a>190 end </span><span class="inferred1"><a
414
- name="line191"></a>191 </span><span class="inferred0"><a
415
- name="line192"></a>192 # 1*(ALPHA / DIGIT / &quot;=&quot;) </span><span
416
- class="marked1"><a name="line193"></a>193 NAME = '[-a-z0-9]+' </span><span
417
- class="inferred0"><a name="line194"></a>194 </span><span
418
- class="inferred1"><a name="line195"></a>195 # &lt;&quot;&gt; &lt;Any
419
- character except CTLs, DQUOTE&gt; &lt;&quot;&gt; </span><span
420
- class="marked0"><a name="line196"></a>196 QSTR = '&quot;[^&quot;]*&quot;'
421
- </span><span class="inferred1"><a name="line197"></a>197 </span><span
422
- class="inferred0"><a name="line198"></a>198 # Contentline </span><span
423
- class="marked1"><a name="line199"></a>199 LINE =
424
- &quot;(#{NAME})(.*(?:#{QSTR})|(?:[^:]*))\:(.*)&quot; </span><span
425
- class="inferred0"><a name="line200"></a>200 </span><span
426
- class="inferred1"><a name="line201"></a>201 # *&lt;Any character except
427
- CTLs, DQUOTE, &quot;;&quot;, &quot;:&quot;, &quot;,&quot;&gt; </span><span
428
- class="marked0"><a name="line202"></a>202 PTEXT = '[^&quot;;:,]*'
429
- </span><span class="inferred1"><a name="line203"></a>203 </span><span
430
- class="inferred0"><a name="line204"></a>204 # param-value = ptext /
431
- quoted-string </span><span class="marked1"><a name="line205"></a>205 PVALUE
432
- = &quot;#{QSTR}|#{PTEXT}&quot; </span><span class="inferred0"><a
433
- name="line206"></a>206 </span><span class="inferred1"><a
434
- name="line207"></a>207 # param = name &quot;=&quot; param-value
435
- *(&quot;,&quot; param-value) </span><span class="marked0"><a
436
- name="line208"></a>208 PARAM =
437
- &quot;;(#{NAME})(=?)((?:#{PVALUE})(?:,#{PVALUE})*)&quot; </span><span
438
- class="inferred1"><a name="line209"></a>209 </span><span class="marked0"><a
439
- name="line210"></a>210 def parse_line(line) </span><span class="marked1"><a
440
- name="line211"></a>211 unless line =~ %r{#{LINE}}i # Case insensitive match
441
- for a valid line </span><span class="uncovered0"><a name="line212"></a>212
442
- raise &quot;Invalid line in calendar string!&quot; </span><span
443
- class="uncovered1"><a name="line213"></a>213 end </span><span
444
- class="inferred0"><a name="line214"></a>214 </span><span class="marked1"><a
445
- name="line215"></a>215 name = $1.upcase # The case insensitive part is
446
- upcased for easier comparison... </span><span class="marked0"><a
447
- name="line216"></a>216 paramslist = $2 </span><span class="marked1"><a
448
- name="line217"></a>217 value = $3.gsub(&quot;\\;&quot;,
449
- &quot;;&quot;).gsub(&quot;\\,&quot;, &quot;,&quot;).gsub(&quot;\\n&quot;,
450
- &quot;\n&quot;).gsub(&quot;\\\\&quot;, &quot;\\&quot;) </span><span
451
- class="inferred0"><a name="line218"></a>218 </span><span
452
- class="inferred1"><a name="line219"></a>219 # Parse the parameters
453
- </span><span class="marked0"><a name="line220"></a>220 params = {}
454
- </span><span class="marked1"><a name="line221"></a>221 if paramslist.size
455
- &gt; 1 </span><span class="marked0"><a name="line222"></a>222
456
- paramslist.scan( %r{#{PARAM}}i ) do </span><span class="inferred1"><a
457
- name="line223"></a>223 </span><span class="inferred0"><a
458
- name="line224"></a>224 # parameter names are case-insensitive, and
459
- multi-valued </span><span class="marked1"><a name="line225"></a>225 pname =
460
- $1 </span><span class="marked0"><a name="line226"></a>226 pvals = $3
461
- </span><span class="inferred1"><a name="line227"></a>227 </span><span
462
- class="inferred0"><a name="line228"></a>228 # If there isn't an '=' sign
463
- then we need to do some custom </span><span class="inferred1"><a
464
- name="line229"></a>229 # business. Defaults to 'type' </span><span
465
- class="marked0"><a name="line230"></a>230 if $2 == &quot;&quot; </span><span
466
- class="uncovered1"><a name="line231"></a>231 pvals = $1 </span><span
467
- class="uncovered0"><a name="line232"></a>232 case $1 </span><span
468
- class="uncovered1"><a name="line233"></a>233 when /quoted-printable/i
469
- </span><span class="uncovered0"><a name="line234"></a>234 pname = 'encoding'
470
- </span><span class="uncovered1"><a name="line235"></a>235 </span><span
471
- class="uncovered0"><a name="line236"></a>236 when /base64/i </span><span
472
- class="uncovered1"><a name="line237"></a>237 pname = 'encoding' </span><span
473
- class="uncovered0"><a name="line238"></a>238 </span><span
474
- class="uncovered1"><a name="line239"></a>239 else </span><span
475
- class="uncovered0"><a name="line240"></a>240 pname = 'type' </span><span
476
- class="uncovered1"><a name="line241"></a>241 end </span><span
477
- class="uncovered0"><a name="line242"></a>242 end </span><span
478
- class="inferred1"><a name="line243"></a>243 </span><span
479
- class="inferred0"><a name="line244"></a>244 # Make entries into the params
480
- dictionary where the name </span><span class="inferred1"><a
481
- name="line245"></a>245 # is the key and the value is an array of values.
482
- </span><span class="marked0"><a name="line246"></a>246 unless params.key?
483
- pname </span><span class="marked1"><a name="line247"></a>247 params[pname] =
484
- [] </span><span class="inferred0"><a name="line248"></a>248 end </span><span
485
- class="inferred1"><a name="line249"></a>249 </span><span
486
- class="inferred0"><a name="line250"></a>250 # Save all the values into the
487
- array. </span><span class="marked1"><a name="line251"></a>251 pvals.scan(
488
- %r{(#{PVALUE})} ) do </span><span class="marked0"><a name="line252"></a>252
489
- if $1.size &gt; 0 </span><span class="marked1"><a name="line253"></a>253
490
- params[pname] &lt;&lt; $1 </span><span class="inferred0"><a
491
- name="line254"></a>254 end </span><span class="inferred1"><a
492
- name="line255"></a>255 end </span><span class="inferred0"><a
493
- name="line256"></a>256 end </span><span class="inferred1"><a
494
- name="line257"></a>257 end </span><span class="inferred0"><a
495
- name="line258"></a>258 </span><span class="marked1"><a
496
- name="line259"></a>259 {:name =&gt; name, :value =&gt; value, :params =&gt;
497
- params} </span><span class="inferred0"><a name="line260"></a>260 end
498
- </span><span class="inferred1"><a name="line261"></a>261 </span><span
499
- class="inferred0"><a name="line262"></a>262 ## Following is a collection of
500
- parsing functions for various </span><span class="inferred1"><a
501
- name="line263"></a>263 ## icalendar property value data types... First we
502
- setup </span><span class="inferred0"><a name="line264"></a>264 ## a hash
503
- with property names pointing to methods... </span><span class="marked1"><a
504
- name="line265"></a>265 def setup_parsers </span><span class="marked0"><a
505
- name="line266"></a>266 @parsers = {} </span><span class="inferred1"><a
506
- name="line267"></a>267 </span><span class="inferred0"><a
507
- name="line268"></a>268 # Integer properties </span><span class="marked1"><a
508
- name="line269"></a>269 m = self.method(:parse_integer) </span><span
509
- class="marked0"><a name="line270"></a>270
510
- @parsers[&quot;PERCENT-COMPLETE&quot;] = m </span><span class="marked1"><a
511
- name="line271"></a>271 @parsers[&quot;PRIORITY&quot;] = m </span><span
512
- class="marked0"><a name="line272"></a>272 @parsers[&quot;REPEAT&quot;] = m
513
- </span><span class="marked1"><a name="line273"></a>273
514
- @parsers[&quot;SEQUENCE&quot;] = m </span><span class="inferred0"><a
515
- name="line274"></a>274 </span><span class="inferred1"><a
516
- name="line275"></a>275 # Dates and Times </span><span class="marked0"><a
517
- name="line276"></a>276 m = self.method(:parse_datetime) </span><span
518
- class="marked1"><a name="line277"></a>277 @parsers[&quot;COMPLETED&quot;] =
519
- m </span><span class="marked0"><a name="line278"></a>278
520
- @parsers[&quot;DTEND&quot;] = m </span><span class="marked1"><a
521
- name="line279"></a>279 @parsers[&quot;DUE&quot;] = m </span><span
522
- class="marked0"><a name="line280"></a>280 @parsers[&quot;DTSTART&quot;] = m
523
- </span><span class="marked1"><a name="line281"></a>281
524
- @parsers[&quot;RECURRENCE-ID&quot;] = m </span><span class="marked0"><a
525
- name="line282"></a>282 @parsers[&quot;EXDATE&quot;] = m </span><span
526
- class="marked1"><a name="line283"></a>283 @parsers[&quot;RDATE&quot;] = m
527
- </span><span class="marked0"><a name="line284"></a>284
528
- @parsers[&quot;CREATED&quot;] = m </span><span class="marked1"><a
529
- name="line285"></a>285 @parsers[&quot;DTSTAMP&quot;] = m </span><span
530
- class="marked0"><a name="line286"></a>286
531
- @parsers[&quot;LAST-MODIFIED&quot;] = m </span><span class="inferred1"><a
532
- name="line287"></a>287 </span><span class="inferred0"><a
533
- name="line288"></a>288 # URI's </span><span class="marked1"><a
534
- name="line289"></a>289 m = self.method(:parse_uri) </span><span
535
- class="marked0"><a name="line290"></a>290 @parsers[&quot;TZURL&quot;] = m
536
- </span><span class="marked1"><a name="line291"></a>291
537
- @parsers[&quot;ATTENDEE&quot;] = m </span><span class="marked0"><a
538
- name="line292"></a>292 @parsers[&quot;ORGANIZER&quot;] = m </span><span
539
- class="marked1"><a name="line293"></a>293 @parsers[&quot;URL&quot;] = m
540
- </span><span class="inferred0"><a name="line294"></a>294 </span><span
541
- class="inferred1"><a name="line295"></a>295 # This is a URI by default, and
542
- if its not a valid URI </span><span class="inferred0"><a
543
- name="line296"></a>296 # it will be returned as a string which works for
544
- binary data </span><span class="inferred1"><a name="line297"></a>297 # the
545
- other possible type. </span><span class="marked0"><a name="line298"></a>298
546
- @parsers[&quot;ATTACH&quot;] = m </span><span class="inferred1"><a
547
- name="line299"></a>299 </span><span class="inferred0"><a
548
- name="line300"></a>300 # GEO </span><span class="marked1"><a
549
- name="line301"></a>301 m = self.method(:parse_geo) </span><span
550
- class="marked0"><a name="line302"></a>302 @parsers[&quot;GEO&quot;] = m
551
- </span><span class="inferred1"><a name="line303"></a>303 </span><span
552
- class="inferred0"><a name="line304"></a>304 #RECUR </span><span
553
- class="marked1"><a name="line305"></a>305 m = self.method(:parse_recur)
554
- </span><span class="marked0"><a name="line306"></a>306
555
- @parsers[&quot;RRULE&quot;] = m </span><span class="marked1"><a
556
- name="line307"></a>307 @parsers[&quot;EXRULE&quot;] = m </span><span
557
- class="inferred0"><a name="line308"></a>308 </span><span
558
- class="inferred1"><a name="line309"></a>309 end </span><span
559
- class="inferred0"><a name="line310"></a>310 </span><span
560
- class="inferred1"><a name="line311"></a>311 # Booleans </span><span
561
- class="inferred0"><a name="line312"></a>312 # NOTE: It appears that although
562
- this is a valid data type </span><span class="inferred1"><a
563
- name="line313"></a>313 # there aren't any properties that use it... Maybe
564
- get </span><span class="inferred0"><a name="line314"></a>314 # rid of this
565
- in the future. </span><span class="marked1"><a name="line315"></a>315 def
566
- parse_boolean(name, params, value) </span><span class="uncovered0"><a
567
- name="line316"></a>316 if value.upcase == &quot;FALSE&quot; </span><span
568
- class="uncovered1"><a name="line317"></a>317 false </span><span
569
- class="uncovered0"><a name="line318"></a>318 else </span><span
570
- class="uncovered1"><a name="line319"></a>319 true </span><span
571
- class="uncovered0"><a name="line320"></a>320 end </span><span
572
- class="uncovered1"><a name="line321"></a>321 end </span><span
573
- class="inferred0"><a name="line322"></a>322 </span><span
574
- class="inferred1"><a name="line323"></a>323 # Dates, Date-Times &amp; Times
575
- </span><span class="inferred0"><a name="line324"></a>324 # NOTE: invalid
576
- dates &amp; times will be returned as strings... </span><span
577
- class="marked1"><a name="line325"></a>325 def parse_datetime(name, params,
578
- value) </span><span class="marked0"><a name="line326"></a>326 begin
579
- </span><span class="marked1"><a name="line327"></a>327 if
580
- params[&quot;VALUE&quot;] &amp;&amp; params[&quot;VALUE&quot;].first ==
581
- &quot;DATE&quot; </span><span class="marked0"><a name="line328"></a>328
582
- result = Date.parse(value) </span><span class="inferred1"><a
583
- name="line329"></a>329 else </span><span class="marked0"><a
584
- name="line330"></a>330 result = DateTime.parse(value) </span><span
585
- class="marked1"><a name="line331"></a>331 if /Z$/ =~ value </span><span
586
- class="marked0"><a name="line332"></a>332 timezone = &quot;UTC&quot;
587
- </span><span class="inferred1"><a name="line333"></a>333 else </span><span
588
- class="marked0"><a name="line334"></a>334 timezone =
589
- params[&quot;TZID&quot;].first if params[&quot;TZID&quot;] </span><span
590
- class="inferred1"><a name="line335"></a>335 end </span><span
591
- class="marked0"><a name="line336"></a>336 result.icalendar_tzid = timezone
592
- </span><span class="inferred1"><a name="line337"></a>337 end </span><span
593
- class="marked0"><a name="line338"></a>338 result </span><span
594
- class="uncovered1"><a name="line339"></a>339 rescue Exception </span><span
595
- class="uncovered0"><a name="line340"></a>340 value </span><span
596
- class="uncovered1"><a name="line341"></a>341 end </span><span
597
- class="uncovered0"><a name="line342"></a>342 end </span><span
598
- class="inferred1"><a name="line343"></a>343 </span><span class="marked0"><a
599
- name="line344"></a>344 def parse_recur(name, params, value) </span><span
600
- class="marked1"><a name="line345"></a>345 ::Icalendar::RRule.new(name,
601
- params, value, self) </span><span class="inferred0"><a
602
- name="line346"></a>346 end </span><span class="inferred1"><a
603
- name="line347"></a>347 </span><span class="inferred0"><a
604
- name="line348"></a>348 # Durations </span><span class="inferred1"><a
605
- name="line349"></a>349 # TODO: Need to figure out the best way to represent
606
- durations </span><span class="inferred0"><a name="line350"></a>350 # so just
607
- returning string for now. </span><span class="marked1"><a
608
- name="line351"></a>351 def parse_duration(name, params, value) </span><span
609
- class="uncovered0"><a name="line352"></a>352 value </span><span
610
- class="uncovered1"><a name="line353"></a>353 end </span><span
611
- class="inferred0"><a name="line354"></a>354 </span><span
612
- class="inferred1"><a name="line355"></a>355 # Floats </span><span
613
- class="inferred0"><a name="line356"></a>356 # NOTE: returns 0.0 if it can't
614
- parse the value </span><span class="marked1"><a name="line357"></a>357 def
615
- parse_float(name, params, value) </span><span class="uncovered0"><a
616
- name="line358"></a>358 value.to_f </span><span class="uncovered1"><a
617
- name="line359"></a>359 end </span><span class="inferred0"><a
618
- name="line360"></a>360 </span><span class="inferred1"><a
619
- name="line361"></a>361 # Integers </span><span class="inferred0"><a
620
- name="line362"></a>362 # NOTE: returns 0 if it can't parse the value
621
- </span><span class="marked1"><a name="line363"></a>363 def
622
- parse_integer(name, params, value) </span><span class="marked0"><a
623
- name="line364"></a>364 value.to_i </span><span class="inferred1"><a
624
- name="line365"></a>365 end </span><span class="inferred0"><a
625
- name="line366"></a>366 </span><span class="inferred1"><a
626
- name="line367"></a>367 # Periods </span><span class="inferred0"><a
627
- name="line368"></a>368 # TODO: Got to figure out how to represent periods
628
- also... </span><span class="marked1"><a name="line369"></a>369 def
629
- parse_period(name, params, value) </span><span class="uncovered0"><a
630
- name="line370"></a>370 value </span><span class="uncovered1"><a
631
- name="line371"></a>371 end </span><span class="inferred0"><a
632
- name="line372"></a>372 </span><span class="inferred1"><a
633
- name="line373"></a>373 # Calendar Address's &amp; URI's </span><span
634
- class="inferred0"><a name="line374"></a>374 # NOTE: invalid URI's will be
635
- returned as strings... </span><span class="marked1"><a
636
- name="line375"></a>375 def parse_uri(name, params, value) </span><span
637
- class="marked0"><a name="line376"></a>376 begin </span><span
638
- class="marked1"><a name="line377"></a>377 URI.parse(value) </span><span
639
- class="uncovered0"><a name="line378"></a>378 rescue Exception </span><span
640
- class="uncovered1"><a name="line379"></a>379 value </span><span
641
- class="uncovered0"><a name="line380"></a>380 end </span><span
642
- class="uncovered1"><a name="line381"></a>381 end </span><span
643
- class="inferred0"><a name="line382"></a>382 </span><span
644
- class="inferred1"><a name="line383"></a>383 # Geographical location (GEO)
645
- </span><span class="inferred0"><a name="line384"></a>384 # NOTE: returns an
646
- array with two floats (long &amp; lat) </span><span class="inferred1"><a
647
- name="line385"></a>385 # if the parsing fails return the string </span><span
648
- class="marked0"><a name="line386"></a>386 def parse_geo(name, params, value)
649
- </span><span class="marked1"><a name="line387"></a>387 strloc =
650
- value.split(';') </span><span class="marked0"><a name="line388"></a>388 if
651
- strloc.size != 2 </span><span class="uncovered1"><a name="line389"></a>389
652
- return value </span><span class="uncovered0"><a name="line390"></a>390 end
653
- </span><span class="inferred1"><a name="line391"></a>391 </span><span
654
- class="marked0"><a name="line392"></a>392 Geo.new(strloc[0].to_f,
655
- strloc[1].to_f) </span><span class="inferred1"><a name="line393"></a>393 end
656
- </span><span class="inferred0"><a name="line394"></a>394 </span><span
657
- class="inferred1"><a name="line395"></a>395 end </span><span
658
- class="inferred0"><a name="line396"></a>396 end </span></pre>
659
- <hr />
660
- <p> Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'> rcov
661
- code coverage analysis tool for Ruby </a> version 0.8.1.2. </p>
662
- <p>
663
- <a href='http://validator.w3.org/check/referer'>
664
- <img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88' />
665
- </a>
666
- <a href='http://jigsaw.w3.org/css-validator/check/referer'>
667
- <img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px' />
668
- </a>
669
- </p>
670
- </body>
671
- </html>