icalendar 0.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +56 -0
- data/GPL +340 -0
- data/README +121 -0
- data/Rakefile +101 -0
- data/docs/api/classes/Array.html +146 -0
- data/docs/api/classes/Date.html +157 -0
- data/docs/api/classes/DateTime.html +178 -0
- data/docs/api/classes/Fixnum.html +146 -0
- data/docs/api/classes/Float.html +146 -0
- data/docs/api/classes/Icalendar/Alarm.html +184 -0
- data/docs/api/classes/Icalendar/Base.html +118 -0
- data/docs/api/classes/Icalendar/Calendar.html +411 -0
- data/docs/api/classes/Icalendar/Component.html +306 -0
- data/docs/api/classes/Icalendar/DateProp.html +187 -0
- data/docs/api/classes/Icalendar/DateProp/ClassMethods.html +195 -0
- data/docs/api/classes/Icalendar/Event.html +202 -0
- data/docs/api/classes/Icalendar/Freebusy.html +157 -0
- data/docs/api/classes/Icalendar/InvalidComponentClass.html +117 -0
- data/docs/api/classes/Icalendar/InvalidPropertyValue.html +117 -0
- data/docs/api/classes/Icalendar/Journal.html +190 -0
- data/docs/api/classes/Icalendar/Parameter.html +166 -0
- data/docs/api/classes/Icalendar/Parser.html +447 -0
- data/docs/api/classes/Icalendar/Timezone.html +197 -0
- data/docs/api/classes/Icalendar/Todo.html +199 -0
- data/docs/api/classes/String.html +160 -0
- data/docs/api/classes/Time.html +161 -0
- data/docs/api/created.rid +1 -0
- data/docs/api/files/COPYING.html +163 -0
- data/docs/api/files/GPL.html +531 -0
- data/docs/api/files/README.html +241 -0
- data/docs/api/files/lib/icalendar/base_rb.html +108 -0
- data/docs/api/files/lib/icalendar/calendar_rb.html +101 -0
- data/docs/api/files/lib/icalendar/component/alarm_rb.html +101 -0
- data/docs/api/files/lib/icalendar/component/event_rb.html +101 -0
- data/docs/api/files/lib/icalendar/component/freebusy_rb.html +101 -0
- data/docs/api/files/lib/icalendar/component/journal_rb.html +101 -0
- data/docs/api/files/lib/icalendar/component/timezone_rb.html +101 -0
- data/docs/api/files/lib/icalendar/component/todo_rb.html +101 -0
- data/docs/api/files/lib/icalendar/component_rb.html +101 -0
- data/docs/api/files/lib/icalendar/conversions_rb.html +108 -0
- data/docs/api/files/lib/icalendar/helpers_rb.html +101 -0
- data/docs/api/files/lib/icalendar/parameter_rb.html +101 -0
- data/docs/api/files/lib/icalendar/parser_rb.html +109 -0
- data/docs/api/files/lib/icalendar_rb.html +118 -0
- data/docs/api/fr_class_index.html +48 -0
- data/docs/api/fr_file_index.html +43 -0
- data/docs/api/fr_method_index.html +63 -0
- data/docs/api/index.html +24 -0
- data/docs/api/rdoc-style.css +208 -0
- data/docs/examples/create_cal.rb +40 -0
- data/docs/examples/parse_cal.rb +19 -0
- data/docs/examples/single_event.ics +18 -0
- data/docs/rfcs/rfc2425.pdf +0 -0
- data/docs/rfcs/rfc2426.pdf +0 -0
- data/docs/rfcs/rfc2445.pdf +0 -0
- data/docs/rfcs/rfc2446.pdf +0 -0
- data/docs/rfcs/rfc2447.pdf +0 -0
- data/docs/rfcs/rfc3283.txt +738 -0
- data/lib/icalendar.rb +27 -0
- data/lib/icalendar/#helpers.rb# +92 -0
- data/lib/icalendar/base.rb +31 -0
- data/lib/icalendar/calendar.rb +112 -0
- data/lib/icalendar/component.rb +253 -0
- data/lib/icalendar/component/alarm.rb +35 -0
- data/lib/icalendar/component/event.rb +68 -0
- data/lib/icalendar/component/freebusy.rb +35 -0
- data/lib/icalendar/component/journal.rb +61 -0
- data/lib/icalendar/component/timezone.rb +43 -0
- data/lib/icalendar/component/todo.rb +65 -0
- data/lib/icalendar/conversions.rb +115 -0
- data/lib/icalendar/helpers.rb +109 -0
- data/lib/icalendar/parameter.rb +33 -0
- data/lib/icalendar/parser.rb +395 -0
- data/test/calendar_test.rb +46 -0
- data/test/component/event_test.rb +47 -0
- data/test/component_test.rb +74 -0
- data/test/parser_test.rb +83 -0
- data/test/property_helpers.rb +35 -0
- data/test/simplecal.ics +119 -0
- data/test/single_event.ics +23 -0
- metadata +135 -0
@@ -0,0 +1,447 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Icalendar::Parser</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Icalendar::Parser</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/icalendar/parser_rb.html">
|
59
|
+
lib/icalendar/parser.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
<a href="Base.html">
|
69
|
+
Icalendar::Base
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<div id="method-list">
|
88
|
+
<h3 class="section-bar">Methods</h3>
|
89
|
+
|
90
|
+
<div class="name-list">
|
91
|
+
<a href="#M000012">new</a>
|
92
|
+
<a href="#M000013">next_line</a>
|
93
|
+
<a href="#M000014">next_line</a>
|
94
|
+
<a href="#M000015">parse</a>
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
|
101
|
+
<!-- if includes -->
|
102
|
+
|
103
|
+
<div id="section">
|
104
|
+
|
105
|
+
|
106
|
+
<div id="constants-list">
|
107
|
+
<h3 class="section-bar">Constants</h3>
|
108
|
+
|
109
|
+
<div class="name-list">
|
110
|
+
<table summary="Constants">
|
111
|
+
<tr class="top-aligned-row context-row">
|
112
|
+
<td class="context-item-name">NAME</td>
|
113
|
+
<td>=</td>
|
114
|
+
<td class="context-item-value">'[-a-z0-9]+'</td>
|
115
|
+
<td width="3em"> </td>
|
116
|
+
<td class="context-item-desc">
|
117
|
+
1*(ALPHA / DIGIT / "=")
|
118
|
+
|
119
|
+
</td>
|
120
|
+
</tr>
|
121
|
+
<tr class="top-aligned-row context-row">
|
122
|
+
<td class="context-item-name">QSTR</td>
|
123
|
+
<td>=</td>
|
124
|
+
<td class="context-item-value">'"[^"]*"'</td>
|
125
|
+
<td width="3em"> </td>
|
126
|
+
<td class="context-item-desc">
|
127
|
+
<"> <Any character except CTLs, DQUOTE> <">
|
128
|
+
|
129
|
+
</td>
|
130
|
+
</tr>
|
131
|
+
<tr class="top-aligned-row context-row">
|
132
|
+
<td class="context-item-name">PTEXT</td>
|
133
|
+
<td>=</td>
|
134
|
+
<td class="context-item-value">'[^";:,]*'</td>
|
135
|
+
<td width="3em"> </td>
|
136
|
+
<td class="context-item-desc">
|
137
|
+
*<Any character except CTLs, DQUOTE, ";", ":",
|
138
|
+
",">
|
139
|
+
|
140
|
+
</td>
|
141
|
+
</tr>
|
142
|
+
<tr class="top-aligned-row context-row">
|
143
|
+
<td class="context-item-name">PVALUE</td>
|
144
|
+
<td>=</td>
|
145
|
+
<td class="context-item-value">"#{PTEXT}|#{QSTR}"</td>
|
146
|
+
<td width="3em"> </td>
|
147
|
+
<td class="context-item-desc">
|
148
|
+
param-value = ptext / quoted-string
|
149
|
+
|
150
|
+
</td>
|
151
|
+
</tr>
|
152
|
+
<tr class="top-aligned-row context-row">
|
153
|
+
<td class="context-item-name">LINE</td>
|
154
|
+
<td>=</td>
|
155
|
+
<td class="context-item-value">"(#{NAME})([^:]*)\:(.*)"</td>
|
156
|
+
<td width="3em"> </td>
|
157
|
+
<td class="context-item-desc">
|
158
|
+
Contentline
|
159
|
+
|
160
|
+
</td>
|
161
|
+
</tr>
|
162
|
+
<tr class="top-aligned-row context-row">
|
163
|
+
<td class="context-item-name">PARAM</td>
|
164
|
+
<td>=</td>
|
165
|
+
<td class="context-item-value">";(#{NAME})(=?)((?:#{PVALUE})(?:,#{PVALUE})*)"</td>
|
166
|
+
<td width="3em"> </td>
|
167
|
+
<td class="context-item-desc">
|
168
|
+
param = name "=" param-value *("," param-value)
|
169
|
+
|
170
|
+
</td>
|
171
|
+
</tr>
|
172
|
+
<tr class="top-aligned-row context-row">
|
173
|
+
<td class="context-item-name">DATE</td>
|
174
|
+
<td>=</td>
|
175
|
+
<td class="context-item-value">'(\d\d\d\d)-?(\d\d)-?(\d\d)'</td>
|
176
|
+
<td width="3em"> </td>
|
177
|
+
<td class="context-item-desc">
|
178
|
+
date = date-fullyear ["-"] date-month ["-"] date-mday
|
179
|
+
date-fullyear = 4 DIGIT date-month = 2 DIGIT date-mday = 2 DIGIT
|
180
|
+
|
181
|
+
</td>
|
182
|
+
</tr>
|
183
|
+
<tr class="top-aligned-row context-row">
|
184
|
+
<td class="context-item-name">TIME</td>
|
185
|
+
<td>=</td>
|
186
|
+
<td class="context-item-value">'(\d\d):?(\d\d):?(\d\d)(\.\d+)?(Z|[-+]\d\d:?\d\d)?'</td>
|
187
|
+
<td width="3em"> </td>
|
188
|
+
<td class="context-item-desc">
|
189
|
+
time = time-hour [":"] time-minute [":"] time-second
|
190
|
+
[time-secfrac] [time-zone] time-hour = 2 DIGIT time-minute = 2 DIGIT
|
191
|
+
time-second = 2 DIGIT time-secfrac = "," 1*DIGIT time-zone =
|
192
|
+
"Z" / time-numzone time-numzome = sign time-hour [":"]
|
193
|
+
time-minute
|
194
|
+
|
195
|
+
</td>
|
196
|
+
</tr>
|
197
|
+
</table>
|
198
|
+
</div>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
<!-- if method_list -->
|
207
|
+
<div id="methods">
|
208
|
+
<h3 class="section-bar">Public Class methods</h3>
|
209
|
+
|
210
|
+
<div id="method-M000012" class="method-detail">
|
211
|
+
<a name="M000012"></a>
|
212
|
+
|
213
|
+
<div class="method-heading">
|
214
|
+
<a href="#M000012" class="method-signature">
|
215
|
+
<span class="method-name">new</span><span class="method-args">(src)</span>
|
216
|
+
</a>
|
217
|
+
</div>
|
218
|
+
|
219
|
+
<div class="method-description">
|
220
|
+
<p><a class="source-toggle" href="#"
|
221
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
222
|
+
<div class="method-source-code" id="M000012-source">
|
223
|
+
<pre>
|
224
|
+
<span class="ruby-comment cmt"># File lib/icalendar/parser.rb, line 48</span>
|
225
|
+
48: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">src</span>)
|
226
|
+
49: <span class="ruby-ivar">@@logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-value str">"New Calendar Parser"</span>)
|
227
|
+
50:
|
228
|
+
51: <span class="ruby-comment cmt"># Setup the parser method hash table</span>
|
229
|
+
52: <span class="ruby-identifier">setup_parsers</span>()
|
230
|
+
53:
|
231
|
+
54: <span class="ruby-comment cmt"># Define the next line method different depending on whether</span>
|
232
|
+
55: <span class="ruby-comment cmt"># this is a string or an IO object so we can be efficient about</span>
|
233
|
+
56: <span class="ruby-comment cmt"># parsing large files...</span>
|
234
|
+
57:
|
235
|
+
58: <span class="ruby-comment cmt"># Just do the unfolding work in one shot if its a whole string</span>
|
236
|
+
59: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">src</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:split</span>)
|
237
|
+
60: <span class="ruby-identifier">unfolded</span> = []
|
238
|
+
61:
|
239
|
+
62: <span class="ruby-comment cmt"># Split into an array of lines, then unfold those into a new array</span>
|
240
|
+
63: <span class="ruby-identifier">src</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\r?\n/</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
241
|
+
64:
|
242
|
+
65: <span class="ruby-comment cmt"># If it's a continuation line, add it to the last.</span>
|
243
|
+
66: <span class="ruby-comment cmt"># If it's an empty line, drop it from the input.</span>
|
244
|
+
67: <span class="ruby-keyword kw">if</span>( <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[ \t]/</span> )
|
245
|
+
68: <span class="ruby-identifier">unfolded</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">unfolded</span>.<span class="ruby-identifier">pop</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">line</span>[<span class="ruby-value">1</span>, <span class="ruby-identifier">line</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>]
|
246
|
+
69: <span class="ruby-keyword kw">elsif</span>( <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^$/</span> )
|
247
|
+
70: <span class="ruby-keyword kw">else</span>
|
248
|
+
71: <span class="ruby-identifier">unfolded</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">line</span>
|
249
|
+
72: <span class="ruby-keyword kw">end</span>
|
250
|
+
73: <span class="ruby-keyword kw">end</span>
|
251
|
+
74:
|
252
|
+
75: <span class="ruby-ivar">@lines</span> = <span class="ruby-identifier">unfolded</span>
|
253
|
+
76: <span class="ruby-ivar">@index</span> = <span class="ruby-value">0</span>
|
254
|
+
77:
|
255
|
+
78: <span class="ruby-comment cmt"># Now that we are unfolded we can just iterate through the array.</span>
|
256
|
+
79: <span class="ruby-comment cmt"># Dynamically define next line for a string.</span>
|
257
|
+
80: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">next_line</span>
|
258
|
+
81: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@index</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@lines</span>.<span class="ruby-identifier">size</span>
|
259
|
+
82: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
260
|
+
83: <span class="ruby-keyword kw">else</span>
|
261
|
+
84: <span class="ruby-identifier">line</span> = <span class="ruby-ivar">@lines</span>[<span class="ruby-ivar">@index</span>]
|
262
|
+
85: <span class="ruby-ivar">@index</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
263
|
+
86: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">line</span>
|
264
|
+
87: <span class="ruby-keyword kw">end</span>
|
265
|
+
88: <span class="ruby-keyword kw">end</span>
|
266
|
+
89:
|
267
|
+
90: <span class="ruby-comment cmt"># If its a file we need to read and unfold on the go to save from reading</span>
|
268
|
+
91: <span class="ruby-comment cmt"># large amounts of data into memory.</span>
|
269
|
+
92: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">src</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:gets</span>)
|
270
|
+
93: <span class="ruby-ivar">@file</span> = <span class="ruby-identifier">src</span>
|
271
|
+
94: <span class="ruby-ivar">@prev_line</span> = <span class="ruby-identifier">src</span>.<span class="ruby-identifier">gets</span>
|
272
|
+
95: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@prev_line</span>.<span class="ruby-identifier">nil?</span>
|
273
|
+
96: <span class="ruby-ivar">@prev_line</span>.<span class="ruby-identifier">chomp!</span>
|
274
|
+
97: <span class="ruby-keyword kw">end</span>
|
275
|
+
98:
|
276
|
+
99: <span class="ruby-comment cmt"># Dynamically define next line for an IO object</span>
|
277
|
+
100: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">next_line</span>
|
278
|
+
101: <span class="ruby-identifier">line</span> = <span class="ruby-ivar">@prev_line</span>
|
279
|
+
102:
|
280
|
+
103: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">nil?</span>
|
281
|
+
104: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
282
|
+
105: <span class="ruby-keyword kw">end</span>
|
283
|
+
106:
|
284
|
+
107: <span class="ruby-comment cmt"># Loop through until we get to a non-continuation line...</span>
|
285
|
+
108: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
286
|
+
109: <span class="ruby-identifier">nextLine</span> = <span class="ruby-ivar">@file</span>.<span class="ruby-identifier">gets</span>
|
287
|
+
110: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">nextLine</span>.<span class="ruby-identifier">nil?</span>
|
288
|
+
111: <span class="ruby-identifier">nextLine</span>.<span class="ruby-identifier">chomp!</span>
|
289
|
+
112: <span class="ruby-keyword kw">end</span>
|
290
|
+
113:
|
291
|
+
114: <span class="ruby-comment cmt"># If it's a continuation line, add it to the last.</span>
|
292
|
+
115: <span class="ruby-comment cmt"># If it's an empty line, drop it from the input.</span>
|
293
|
+
116: <span class="ruby-keyword kw">if</span>( <span class="ruby-identifier">nextLine</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[ \t]/</span> )
|
294
|
+
117: <span class="ruby-identifier">line</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">nextLine</span>[<span class="ruby-value">1</span>, <span class="ruby-identifier">nextLine</span>.<span class="ruby-identifier">size</span>]
|
295
|
+
118: <span class="ruby-keyword kw">elsif</span>( <span class="ruby-identifier">nextLine</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^$/</span> )
|
296
|
+
119: <span class="ruby-keyword kw">else</span>
|
297
|
+
120: <span class="ruby-ivar">@prev_line</span> = <span class="ruby-identifier">nextLine</span>
|
298
|
+
121: <span class="ruby-keyword kw">break</span>
|
299
|
+
122: <span class="ruby-keyword kw">end</span>
|
300
|
+
123: <span class="ruby-keyword kw">end</span>
|
301
|
+
124: <span class="ruby-identifier">line</span>
|
302
|
+
125: <span class="ruby-keyword kw">end</span>
|
303
|
+
126: <span class="ruby-keyword kw">else</span>
|
304
|
+
127: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"CalendarParser.new cannot be called with a #{src.class} type!"</span>
|
305
|
+
128: <span class="ruby-keyword kw">end</span>
|
306
|
+
129: <span class="ruby-keyword kw">end</span>
|
307
|
+
</pre>
|
308
|
+
</div>
|
309
|
+
</div>
|
310
|
+
</div>
|
311
|
+
|
312
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
313
|
+
|
314
|
+
<div id="method-M000013" class="method-detail">
|
315
|
+
<a name="M000013"></a>
|
316
|
+
|
317
|
+
<div class="method-heading">
|
318
|
+
<a href="#M000013" class="method-signature">
|
319
|
+
<span class="method-name">next_line</span><span class="method-args">()</span>
|
320
|
+
</a>
|
321
|
+
</div>
|
322
|
+
|
323
|
+
<div class="method-description">
|
324
|
+
<p>
|
325
|
+
Now that we are unfolded we can just iterate through the array. Dynamically
|
326
|
+
define next line for a string.
|
327
|
+
</p>
|
328
|
+
<p><a class="source-toggle" href="#"
|
329
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
330
|
+
<div class="method-source-code" id="M000013-source">
|
331
|
+
<pre>
|
332
|
+
<span class="ruby-comment cmt"># File lib/icalendar/parser.rb, line 80</span>
|
333
|
+
80: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">next_line</span>
|
334
|
+
81: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@index</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@lines</span>.<span class="ruby-identifier">size</span>
|
335
|
+
82: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
336
|
+
83: <span class="ruby-keyword kw">else</span>
|
337
|
+
84: <span class="ruby-identifier">line</span> = <span class="ruby-ivar">@lines</span>[<span class="ruby-ivar">@index</span>]
|
338
|
+
85: <span class="ruby-ivar">@index</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
339
|
+
86: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">line</span>
|
340
|
+
87: <span class="ruby-keyword kw">end</span>
|
341
|
+
88: <span class="ruby-keyword kw">end</span>
|
342
|
+
</pre>
|
343
|
+
</div>
|
344
|
+
</div>
|
345
|
+
</div>
|
346
|
+
|
347
|
+
<div id="method-M000014" class="method-detail">
|
348
|
+
<a name="M000014"></a>
|
349
|
+
|
350
|
+
<div class="method-heading">
|
351
|
+
<a href="#M000014" class="method-signature">
|
352
|
+
<span class="method-name">next_line</span><span class="method-args">()</span>
|
353
|
+
</a>
|
354
|
+
</div>
|
355
|
+
|
356
|
+
<div class="method-description">
|
357
|
+
<p>
|
358
|
+
Dynamically define next line for an IO object
|
359
|
+
</p>
|
360
|
+
<p><a class="source-toggle" href="#"
|
361
|
+
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
362
|
+
<div class="method-source-code" id="M000014-source">
|
363
|
+
<pre>
|
364
|
+
<span class="ruby-comment cmt"># File lib/icalendar/parser.rb, line 100</span>
|
365
|
+
100: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">next_line</span>
|
366
|
+
101: <span class="ruby-identifier">line</span> = <span class="ruby-ivar">@prev_line</span>
|
367
|
+
102:
|
368
|
+
103: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">nil?</span>
|
369
|
+
104: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
370
|
+
105: <span class="ruby-keyword kw">end</span>
|
371
|
+
106:
|
372
|
+
107: <span class="ruby-comment cmt"># Loop through until we get to a non-continuation line...</span>
|
373
|
+
108: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
374
|
+
109: <span class="ruby-identifier">nextLine</span> = <span class="ruby-ivar">@file</span>.<span class="ruby-identifier">gets</span>
|
375
|
+
110: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">nextLine</span>.<span class="ruby-identifier">nil?</span>
|
376
|
+
111: <span class="ruby-identifier">nextLine</span>.<span class="ruby-identifier">chomp!</span>
|
377
|
+
112: <span class="ruby-keyword kw">end</span>
|
378
|
+
113:
|
379
|
+
114: <span class="ruby-comment cmt"># If it's a continuation line, add it to the last.</span>
|
380
|
+
115: <span class="ruby-comment cmt"># If it's an empty line, drop it from the input.</span>
|
381
|
+
116: <span class="ruby-keyword kw">if</span>( <span class="ruby-identifier">nextLine</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[ \t]/</span> )
|
382
|
+
117: <span class="ruby-identifier">line</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">nextLine</span>[<span class="ruby-value">1</span>, <span class="ruby-identifier">nextLine</span>.<span class="ruby-identifier">size</span>]
|
383
|
+
118: <span class="ruby-keyword kw">elsif</span>( <span class="ruby-identifier">nextLine</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^$/</span> )
|
384
|
+
119: <span class="ruby-keyword kw">else</span>
|
385
|
+
120: <span class="ruby-ivar">@prev_line</span> = <span class="ruby-identifier">nextLine</span>
|
386
|
+
121: <span class="ruby-keyword kw">break</span>
|
387
|
+
122: <span class="ruby-keyword kw">end</span>
|
388
|
+
123: <span class="ruby-keyword kw">end</span>
|
389
|
+
124: <span class="ruby-identifier">line</span>
|
390
|
+
125: <span class="ruby-keyword kw">end</span>
|
391
|
+
</pre>
|
392
|
+
</div>
|
393
|
+
</div>
|
394
|
+
</div>
|
395
|
+
|
396
|
+
<div id="method-M000015" class="method-detail">
|
397
|
+
<a name="M000015"></a>
|
398
|
+
|
399
|
+
<div class="method-heading">
|
400
|
+
<a href="#M000015" class="method-signature">
|
401
|
+
<span class="method-name">parse</span><span class="method-args">()</span>
|
402
|
+
</a>
|
403
|
+
</div>
|
404
|
+
|
405
|
+
<div class="method-description">
|
406
|
+
<p>
|
407
|
+
Parse the calendar into an object representation
|
408
|
+
</p>
|
409
|
+
<p><a class="source-toggle" href="#"
|
410
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
411
|
+
<div class="method-source-code" id="M000015-source">
|
412
|
+
<pre>
|
413
|
+
<span class="ruby-comment cmt"># File lib/icalendar/parser.rb, line 132</span>
|
414
|
+
132: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>
|
415
|
+
133: <span class="ruby-identifier">calendars</span> = []
|
416
|
+
134:
|
417
|
+
135: <span class="ruby-comment cmt"># Outer loop for Calendar objects</span>
|
418
|
+
136: <span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">line</span> = <span class="ruby-identifier">next_line</span>)
|
419
|
+
137: <span class="ruby-identifier">fields</span> = <span class="ruby-identifier">parse_line</span>(<span class="ruby-identifier">line</span>)
|
420
|
+
138:
|
421
|
+
139: <span class="ruby-comment cmt"># Just iterate through until we find the beginning of a calendar object</span>
|
422
|
+
140: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fields</span>[<span class="ruby-identifier">:name</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"BEGIN"</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">fields</span>[<span class="ruby-identifier">:value</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"VCALENDAR"</span>
|
423
|
+
141: <span class="ruby-identifier">cal</span> = <span class="ruby-identifier">parse_component</span>
|
424
|
+
142: <span class="ruby-identifier">calendars</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">cal</span>
|
425
|
+
143: <span class="ruby-keyword kw">end</span>
|
426
|
+
144: <span class="ruby-keyword kw">end</span>
|
427
|
+
145:
|
428
|
+
146: <span class="ruby-identifier">calendars</span>
|
429
|
+
147: <span class="ruby-keyword kw">end</span>
|
430
|
+
</pre>
|
431
|
+
</div>
|
432
|
+
</div>
|
433
|
+
</div>
|
434
|
+
|
435
|
+
|
436
|
+
</div>
|
437
|
+
|
438
|
+
|
439
|
+
</div>
|
440
|
+
|
441
|
+
|
442
|
+
<div id="validator-badges">
|
443
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
444
|
+
</div>
|
445
|
+
|
446
|
+
</body>
|
447
|
+
</html>
|
@@ -0,0 +1,197 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Icalendar::Timezone</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Icalendar::Timezone</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/icalendar/component/timezone_rb.html">
|
59
|
+
lib/icalendar/component/timezone.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
<a href="Component.html">
|
69
|
+
Component
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
<div id="description">
|
84
|
+
<p>
|
85
|
+
A <a href="Timezone.html">Timezone</a> is unambiguously defined by the set
|
86
|
+
of time measurement rules determined by the governing body for a given
|
87
|
+
geographic area. These rules describe at a minimum the base offset from UTC
|
88
|
+
for the time zone, often referred to as the Standard <a
|
89
|
+
href="../Time.html">Time</a> offset. Many locations adjust their Standard
|
90
|
+
<a href="../Time.html">Time</a> forward or backward by one hour, in order
|
91
|
+
to accommodate seasonal changes in number of daylight hours, often referred
|
92
|
+
to as Daylight Saving <a href="../Time.html">Time</a>. Some locations
|
93
|
+
adjust their time by a fraction of an hour. Standard <a
|
94
|
+
href="../Time.html">Time</a> is also known as Winter <a
|
95
|
+
href="../Time.html">Time</a>. Daylight Saving <a
|
96
|
+
href="../Time.html">Time</a> is also known as Advanced <a
|
97
|
+
href="../Time.html">Time</a>, Summer <a href="../Time.html">Time</a>, or
|
98
|
+
Legal <a href="../Time.html">Time</a> in certain countries. The following
|
99
|
+
table shows the changes in time zone rules in effect for New York City
|
100
|
+
starting from 1967. Each line represents a description or rule for a
|
101
|
+
particular observance.
|
102
|
+
</p>
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
|
107
|
+
</div>
|
108
|
+
|
109
|
+
<div id="method-list">
|
110
|
+
<h3 class="section-bar">Methods</h3>
|
111
|
+
|
112
|
+
<div class="name-list">
|
113
|
+
<a href="#M000020">new</a>
|
114
|
+
<a href="#M000021">to_ical</a>
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
|
121
|
+
<!-- if includes -->
|
122
|
+
|
123
|
+
<div id="section">
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
<!-- if method_list -->
|
133
|
+
<div id="methods">
|
134
|
+
<h3 class="section-bar">Public Class methods</h3>
|
135
|
+
|
136
|
+
<div id="method-M000020" class="method-detail">
|
137
|
+
<a name="M000020"></a>
|
138
|
+
|
139
|
+
<div class="method-heading">
|
140
|
+
<a href="#M000020" class="method-signature">
|
141
|
+
<span class="method-name">new</span><span class="method-args">()</span>
|
142
|
+
</a>
|
143
|
+
</div>
|
144
|
+
|
145
|
+
<div class="method-description">
|
146
|
+
<p><a class="source-toggle" href="#"
|
147
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
148
|
+
<div class="method-source-code" id="M000020-source">
|
149
|
+
<pre>
|
150
|
+
<span class="ruby-comment cmt"># File lib/icalendar/component/timezone.rb, line 34</span>
|
151
|
+
34: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>()
|
152
|
+
35: <span class="ruby-keyword kw">super</span>(<span class="ruby-value str">"VTIMEZONE"</span>)
|
153
|
+
36: <span class="ruby-ivar">@components</span> = <span class="ruby-identifier">components</span>
|
154
|
+
37: <span class="ruby-keyword kw">end</span>
|
155
|
+
</pre>
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
|
160
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
161
|
+
|
162
|
+
<div id="method-M000021" class="method-detail">
|
163
|
+
<a name="M000021"></a>
|
164
|
+
|
165
|
+
<div class="method-heading">
|
166
|
+
<a href="#M000021" class="method-signature">
|
167
|
+
<span class="method-name">to_ical</span><span class="method-args">()</span>
|
168
|
+
</a>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<div class="method-description">
|
172
|
+
<p><a class="source-toggle" href="#"
|
173
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
174
|
+
<div class="method-source-code" id="M000021-source">
|
175
|
+
<pre>
|
176
|
+
<span class="ruby-comment cmt"># File lib/icalendar/component/timezone.rb, line 39</span>
|
177
|
+
39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_ical</span>
|
178
|
+
40: <span class="ruby-keyword kw">super</span>.<span class="ruby-identifier">to_s</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@components</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">component</span><span class="ruby-operator">|</span> <span class="ruby-identifier">component</span>.<span class="ruby-identifier">to_s</span> } }
|
179
|
+
41: <span class="ruby-keyword kw">end</span>
|
180
|
+
</pre>
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
|
185
|
+
|
186
|
+
</div>
|
187
|
+
|
188
|
+
|
189
|
+
</div>
|
190
|
+
|
191
|
+
|
192
|
+
<div id="validator-badges">
|
193
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
194
|
+
</div>
|
195
|
+
|
196
|
+
</body>
|
197
|
+
</html>
|