icalendar 0.96 → 0.96.1
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/README +3 -3
- data/Rakefile +3 -4
- data/docs/api/classes/Array.html +148 -0
- data/docs/api/classes/Date.html +159 -0
- data/docs/api/classes/DateTime.html +180 -0
- data/docs/api/classes/Fixnum.html +148 -0
- data/docs/api/classes/Float.html +148 -0
- data/docs/api/classes/HashAttrs.html +199 -0
- data/docs/api/classes/Icalendar/Alarm.html +228 -0
- data/docs/api/classes/Icalendar/Base.html +120 -0
- data/docs/api/classes/Icalendar/Calendar.html +365 -0
- data/docs/api/classes/Icalendar/Component.html +689 -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/Daylight.html +156 -0
- data/docs/api/classes/Icalendar/Event.html +650 -0
- data/docs/api/classes/Icalendar/Freebusy.html +297 -0
- data/docs/api/classes/Icalendar/InvalidPropertyValue.html +117 -0
- data/docs/api/classes/Icalendar/Journal.html +459 -0
- data/docs/api/classes/Icalendar/Parameter.html +166 -0
- data/docs/api/classes/Icalendar/Parser.html +447 -0
- data/docs/api/classes/Icalendar/Standard.html +156 -0
- data/docs/api/classes/Icalendar/Timezone.html +351 -0
- data/docs/api/classes/Icalendar/Todo.html +496 -0
- data/docs/api/classes/Icalendar/UnknownComponentClass.html +117 -0
- data/docs/api/classes/Icalendar/UnknownPropertyMethod.html +117 -0
- data/docs/api/classes/Object.html +270 -0
- data/docs/api/classes/String.html +148 -0
- data/docs/api/classes/Time.html +163 -0
- data/docs/api/classes/URI.html +111 -0
- data/docs/api/classes/URI/Generic.html +148 -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 +254 -0
- data/docs/api/files/lib/hash_attrs_rb.html +107 -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 +109 -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 +120 -0
- data/docs/api/files/lib/meta_rb.html +107 -0
- data/docs/api/fr_class_index.html +55 -0
- data/docs/api/fr_file_index.html +45 -0
- data/docs/api/fr_method_index.html +79 -0
- data/docs/api/index.html +24 -0
- data/docs/api/rdoc-style.css +208 -0
- data/{docs/examples → examples}/create_cal.rb +6 -2
- data/{docs/examples → examples}/parse_cal.rb +3 -2
- data/{docs/examples → examples}/single_event.ics +0 -0
- data/lib/hash_attrs.rb +29 -0
- data/lib/icalendar.rb +11 -2
- data/lib/icalendar/base.rb +6 -2
- data/lib/icalendar/calendar.rb +1 -1
- data/lib/icalendar/component.rb +98 -71
- data/lib/icalendar/component/alarm.rb +5 -3
- data/lib/icalendar/component/event.rb +1 -1
- data/lib/icalendar/component/freebusy.rb +23 -23
- data/lib/icalendar/component/journal.rb +1 -5
- data/lib/icalendar/component/timezone.rb +7 -0
- data/lib/icalendar/component/todo.rb +1 -6
- data/lib/icalendar/conversions.rb +10 -0
- data/lib/icalendar/parser.rb +82 -85
- data/lib/meta.rb +32 -0
- data/test/component_test.rb +69 -64
- metadata +74 -12
- data/lib/icalendar/foo.rb +0 -394
- data/test/property_helpers.rb +0 -35
|
@@ -0,0 +1,166 @@
|
|
|
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::Parameter</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::Parameter</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/lib/icalendar/parameter_rb.html">
|
|
59
|
+
lib/icalendar/parameter.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
|
+
Icalendar::Content
|
|
69
|
+
</td>
|
|
70
|
+
</tr>
|
|
71
|
+
</table>
|
|
72
|
+
</div>
|
|
73
|
+
<!-- banner header -->
|
|
74
|
+
|
|
75
|
+
<div id="bodyContent">
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<div id="contextContent">
|
|
80
|
+
|
|
81
|
+
<div id="description">
|
|
82
|
+
<p>
|
|
83
|
+
A property can have attributes associated with it. These "property
|
|
84
|
+
parameters" contain meta-information about the property or the
|
|
85
|
+
property value. Property parameters are provided to specify such
|
|
86
|
+
information as the location of an alternate text representation for a
|
|
87
|
+
property value, the language of a text property value, the data type of the
|
|
88
|
+
property value and other attributes.
|
|
89
|
+
</p>
|
|
90
|
+
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<div id="method-list">
|
|
97
|
+
<h3 class="section-bar">Methods</h3>
|
|
98
|
+
|
|
99
|
+
<div class="name-list">
|
|
100
|
+
<a href="#M000049">to_s</a>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
<!-- if includes -->
|
|
108
|
+
|
|
109
|
+
<div id="section">
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
<!-- if method_list -->
|
|
119
|
+
<div id="methods">
|
|
120
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
121
|
+
|
|
122
|
+
<div id="method-M000049" class="method-detail">
|
|
123
|
+
<a name="M000049"></a>
|
|
124
|
+
|
|
125
|
+
<div class="method-heading">
|
|
126
|
+
<a href="#M000049" class="method-signature">
|
|
127
|
+
<span class="method-name">to_s</span><span class="method-args">()</span>
|
|
128
|
+
</a>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<div class="method-description">
|
|
132
|
+
<p><a class="source-toggle" href="#"
|
|
133
|
+
onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
|
|
134
|
+
<div class="method-source-code" id="M000049-source">
|
|
135
|
+
<pre>
|
|
136
|
+
<span class="ruby-comment cmt"># File lib/icalendar/parameter.rb, line 19</span>
|
|
137
|
+
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
|
138
|
+
20: <span class="ruby-identifier">s</span> = <span class="ruby-value str">""</span>
|
|
139
|
+
21:
|
|
140
|
+
22: <span class="ruby-identifier">s</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{@name}="</span>
|
|
141
|
+
23: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_escapable?</span>
|
|
142
|
+
24: <span class="ruby-identifier">s</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">escape</span>(<span class="ruby-identifier">print_value</span>())
|
|
143
|
+
25: <span class="ruby-keyword kw">else</span>
|
|
144
|
+
26: <span class="ruby-identifier">s</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">print_value</span>
|
|
145
|
+
27: <span class="ruby-keyword kw">end</span>
|
|
146
|
+
28:
|
|
147
|
+
29: <span class="ruby-identifier">s</span>
|
|
148
|
+
30: <span class="ruby-keyword kw">end</span>
|
|
149
|
+
</pre>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
<div id="validator-badges">
|
|
162
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
</body>
|
|
166
|
+
</html>
|
|
@@ -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="#M000017">new</a>
|
|
92
|
+
<a href="#M000018">next_line</a>
|
|
93
|
+
<a href="#M000019">next_line</a>
|
|
94
|
+
<a href="#M000020">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-M000017" class="method-detail">
|
|
211
|
+
<a name="M000017"></a>
|
|
212
|
+
|
|
213
|
+
<div class="method-heading">
|
|
214
|
+
<a href="#M000017" 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('M000017-source');return false;">[Source]</a></p>
|
|
222
|
+
<div class="method-source-code" id="M000017-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-M000018" class="method-detail">
|
|
315
|
+
<a name="M000018"></a>
|
|
316
|
+
|
|
317
|
+
<div class="method-heading">
|
|
318
|
+
<a href="#M000018" 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('M000018-source');return false;">[Source]</a></p>
|
|
330
|
+
<div class="method-source-code" id="M000018-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-M000019" class="method-detail">
|
|
348
|
+
<a name="M000019"></a>
|
|
349
|
+
|
|
350
|
+
<div class="method-heading">
|
|
351
|
+
<a href="#M000019" 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('M000019-source');return false;">[Source]</a></p>
|
|
362
|
+
<div class="method-source-code" id="M000019-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-M000020" class="method-detail">
|
|
397
|
+
<a name="M000020"></a>
|
|
398
|
+
|
|
399
|
+
<div class="method-heading">
|
|
400
|
+
<a href="#M000020" 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('M000020-source');return false;">[Source]</a></p>
|
|
411
|
+
<div class="method-source-code" id="M000020-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>
|