atom-tools 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/COPYING +18 -0
  2. data/README +103 -0
  3. data/Rakefile +77 -0
  4. data/bin/atom-client.rb +246 -0
  5. data/bin/atom-server.rb~ +71 -0
  6. data/doc/classes/Atom/App.html +217 -0
  7. data/doc/classes/Atom/Author.html +130 -0
  8. data/doc/classes/Atom/Category.html +128 -0
  9. data/doc/classes/Atom/Collection.html +322 -0
  10. data/doc/classes/Atom/Content.html +129 -0
  11. data/doc/classes/Atom/Contributor.html +119 -0
  12. data/doc/classes/Atom/Element.html +325 -0
  13. data/doc/classes/Atom/Entry.html +365 -0
  14. data/doc/classes/Atom/Feed.html +585 -0
  15. data/doc/classes/Atom/HTTP.html +374 -0
  16. data/doc/classes/Atom/Link.html +137 -0
  17. data/doc/classes/Atom/Text.html +229 -0
  18. data/doc/classes/XHTML.html +118 -0
  19. data/doc/created.rid +1 -0
  20. data/doc/files/README.html +213 -0
  21. data/doc/files/lib/atom/app_rb.html +110 -0
  22. data/doc/files/lib/atom/collection_rb.html +110 -0
  23. data/doc/files/lib/atom/element_rb.html +109 -0
  24. data/doc/files/lib/atom/entry_rb.html +111 -0
  25. data/doc/files/lib/atom/feed_rb.html +112 -0
  26. data/doc/files/lib/atom/http_rb.html +109 -0
  27. data/doc/files/lib/atom/text_rb.html +108 -0
  28. data/doc/files/lib/atom/xml_rb.html +110 -0
  29. data/doc/files/lib/atom/yaml_rb.html +109 -0
  30. data/doc/fr_class_index.html +39 -0
  31. data/doc/fr_file_index.html +36 -0
  32. data/doc/fr_method_index.html +62 -0
  33. data/doc/index.html +24 -0
  34. data/doc/rdoc-style.css +208 -0
  35. data/lib/atom/app.rb +87 -0
  36. data/lib/atom/collection.rb +75 -0
  37. data/lib/atom/element.rb +277 -0
  38. data/lib/atom/entry.rb +135 -0
  39. data/lib/atom/feed.rb +229 -0
  40. data/lib/atom/http.rb +132 -0
  41. data/lib/atom/text.rb +163 -0
  42. data/lib/atom/xml.rb +200 -0
  43. data/lib/atom/yaml.rb +101 -0
  44. data/setup.rb +1585 -0
  45. data/test/conformance/order.rb +117 -0
  46. data/test/conformance/title.rb +108 -0
  47. data/test/conformance/updated.rb +33 -0
  48. data/test/conformance/xhtmlcontentdiv.rb +18 -0
  49. data/test/conformance/xmlnamespace.rb +54 -0
  50. data/test/runtests.rb +14 -0
  51. data/test/test_constructs.rb +91 -0
  52. data/test/test_feed.rb +128 -0
  53. data/test/test_general.rb +99 -0
  54. data/test/test_http.rb +86 -0
  55. data/test/test_protocol.rb +69 -0
  56. data/test/test_xml.rb +353 -0
  57. metadata +107 -0
@@ -0,0 +1,119 @@
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: Atom::Contributor</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">Atom::Contributor</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/atom/element_rb.html">
59
+ lib/atom/element.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="Element.html">
69
+ Atom::Element
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
+ same as <a href="Author.html">Atom::Author</a>
86
+ </p>
87
+
88
+ </div>
89
+
90
+
91
+ </div>
92
+
93
+
94
+ </div>
95
+
96
+
97
+ <!-- if includes -->
98
+
99
+ <div id="section">
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+ <!-- if method_list -->
109
+
110
+
111
+ </div>
112
+
113
+
114
+ <div id="validator-badges">
115
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
116
+ </div>
117
+
118
+ </body>
119
+ </html>
@@ -0,0 +1,325 @@
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: Atom::Element</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">Atom::Element</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/atom/yaml_rb.html">
59
+ lib/atom/yaml.rb
60
+ </a>
61
+ <br />
62
+ <a href="../../files/lib/atom/element_rb.html">
63
+ lib/atom/element.rb
64
+ </a>
65
+ <br />
66
+ </td>
67
+ </tr>
68
+
69
+ <tr class="top-aligned-row">
70
+ <td><strong>Parent:</strong></td>
71
+ <td>
72
+ Hash
73
+ </td>
74
+ </tr>
75
+ </table>
76
+ </div>
77
+ <!-- banner header -->
78
+
79
+ <div id="bodyContent">
80
+
81
+
82
+
83
+ <div id="contextContent">
84
+
85
+
86
+
87
+ </div>
88
+
89
+ <div id="method-list">
90
+ <h3 class="section-bar">Methods</h3>
91
+
92
+ <div class="name-list">
93
+ <a href="#M000032">[]</a>&nbsp;&nbsp;
94
+ <a href="#M000033">[]=</a>&nbsp;&nbsp;
95
+ <a href="#M000034">to_element</a>&nbsp;&nbsp;
96
+ <a href="#M000036">to_s</a>&nbsp;&nbsp;
97
+ <a href="#M000035">to_xml</a>&nbsp;&nbsp;
98
+ </div>
99
+ </div>
100
+
101
+ </div>
102
+
103
+
104
+ <!-- if includes -->
105
+
106
+ <div id="section">
107
+
108
+
109
+
110
+
111
+
112
+ <div id="attribute-list">
113
+ <h3 class="section-bar">Attributes</h3>
114
+
115
+ <div class="name-list">
116
+ <table>
117
+ <tr class="top-aligned-row context-row">
118
+ <td class="context-item-name">base</td>
119
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
120
+ <td class="context-item-desc">
121
+ this element&#8217;s xml:base
122
+
123
+ </td>
124
+ </tr>
125
+ <tr class="top-aligned-row context-row">
126
+ <td class="context-item-name">extensions</td>
127
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
128
+ <td class="context-item-desc">
129
+ a REXML::Element that shares this element&#8217;s extension attributes and
130
+ child elements
131
+
132
+ </td>
133
+ </tr>
134
+ </table>
135
+ </div>
136
+ </div>
137
+
138
+
139
+
140
+ <!-- if method_list -->
141
+ <div id="methods">
142
+ <h3 class="section-bar">Public Instance methods</h3>
143
+
144
+ <div id="method-M000032" class="method-detail">
145
+ <a name="M000032"></a>
146
+
147
+ <div class="method-heading">
148
+ <a href="#M000032" class="method-signature">
149
+ <span class="method-name">[]</span><span class="method-args">(key)</span>
150
+ </a>
151
+ </div>
152
+
153
+ <div class="method-description">
154
+ <p>
155
+ get the value of an attribute
156
+ </p>
157
+ <p><a class="source-toggle" href="#"
158
+ onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
159
+ <div class="method-source-code" id="M000032-source">
160
+ <pre>
161
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 115</span>
162
+ 115: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span> <span class="ruby-identifier">key</span>
163
+ 116: <span class="ruby-identifier">test_key</span> <span class="ruby-identifier">key</span>
164
+ 117:
165
+ 118: <span class="ruby-keyword kw">super</span>
166
+ 119: <span class="ruby-keyword kw">end</span>
167
+ </pre>
168
+ </div>
169
+ </div>
170
+ </div>
171
+
172
+ <div id="method-M000033" class="method-detail">
173
+ <a name="M000033"></a>
174
+
175
+ <div class="method-heading">
176
+ <a href="#M000033" class="method-signature">
177
+ <span class="method-name">[]=</span><span class="method-args">(key, value)</span>
178
+ </a>
179
+ </div>
180
+
181
+ <div class="method-description">
182
+ <p>
183
+ set the value of an attribute
184
+ </p>
185
+ <p><a class="source-toggle" href="#"
186
+ onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
187
+ <div class="method-source-code" id="M000033-source">
188
+ <pre>
189
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 122</span>
190
+ 122: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span> <span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>
191
+ 123: <span class="ruby-identifier">test_key</span> <span class="ruby-identifier">key</span>
192
+ 124:
193
+ 125: <span class="ruby-keyword kw">super</span>
194
+ 126: <span class="ruby-keyword kw">end</span>
195
+ </pre>
196
+ </div>
197
+ </div>
198
+ </div>
199
+
200
+ <div id="method-M000034" class="method-detail">
201
+ <a name="M000034"></a>
202
+
203
+ <div class="method-heading">
204
+ <a href="#M000034" class="method-signature">
205
+ <span class="method-name">to_element</span><span class="method-args">()</span>
206
+ </a>
207
+ </div>
208
+
209
+ <div class="method-description">
210
+ <p>
211
+ convert to a REXML::Element (with no namespace)
212
+ </p>
213
+ <p><a class="source-toggle" href="#"
214
+ onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
215
+ <div class="method-source-code" id="M000034-source">
216
+ <pre>
217
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 147</span>
218
+ 147: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_element</span>
219
+ 148: <span class="ruby-identifier">elem</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Element</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">local_name</span>)
220
+ 149:
221
+ 150: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">elements</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>,<span class="ruby-identifier">kind</span>,<span class="ruby-identifier">req</span><span class="ruby-operator">|</span>
222
+ 151: <span class="ruby-identifier">v</span> = <span class="ruby-identifier">get</span>(<span class="ruby-identifier">name</span>)
223
+ 152: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">nil?</span>
224
+ 153:
225
+ 154: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:to_element</span>
226
+ 155: <span class="ruby-identifier">e</span> = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_element</span>
227
+ 156: <span class="ruby-identifier">e</span> = [ <span class="ruby-identifier">e</span> ] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Array</span>
228
+ 157:
229
+ 158: <span class="ruby-identifier">e</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">bit</span><span class="ruby-operator">|</span>
230
+ 159: <span class="ruby-identifier">elem</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">bit</span>
231
+ 160: <span class="ruby-keyword kw">end</span>
232
+ 161: <span class="ruby-keyword kw">else</span>
233
+ 162: <span class="ruby-identifier">e</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Element</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">elem</span>).<span class="ruby-identifier">text</span> = <span class="ruby-identifier">get</span>(<span class="ruby-identifier">name</span>)
234
+ 163: <span class="ruby-keyword kw">end</span>
235
+ 164: <span class="ruby-keyword kw">end</span>
236
+ 165:
237
+ 166: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>,<span class="ruby-identifier">req</span><span class="ruby-operator">|</span>
238
+ 167: <span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>]
239
+ 168: <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">value</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>
240
+ 169: <span class="ruby-keyword kw">end</span>
241
+ 170:
242
+ 171: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">extensions</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">element</span><span class="ruby-operator">|</span>
243
+ 172: <span class="ruby-identifier">elem</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">element</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># otherwise they get removed from @extensions</span>
244
+ 173: <span class="ruby-keyword kw">end</span>
245
+ 174:
246
+ 175: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">base</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">base</span>.<span class="ruby-identifier">empty?</span>
247
+ 176: <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;xml:base&quot;</span>] = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">base</span>
248
+ 177: <span class="ruby-keyword kw">end</span>
249
+ 178:
250
+ 179: <span class="ruby-identifier">elem</span>
251
+ 180: <span class="ruby-keyword kw">end</span>
252
+ </pre>
253
+ </div>
254
+ </div>
255
+ </div>
256
+
257
+ <div id="method-M000036" class="method-detail">
258
+ <a name="M000036"></a>
259
+
260
+ <div class="method-heading">
261
+ <a href="#M000036" class="method-signature">
262
+ <span class="method-name">to_s</span><span class="method-args">()</span>
263
+ </a>
264
+ </div>
265
+
266
+ <div class="method-description">
267
+ <p>
268
+ convert to an XML string
269
+ </p>
270
+ <p><a class="source-toggle" href="#"
271
+ onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
272
+ <div class="method-source-code" id="M000036-source">
273
+ <pre>
274
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 192</span>
275
+ 192: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
276
+ 193: <span class="ruby-identifier">to_xml</span>.<span class="ruby-identifier">to_s</span>
277
+ 194: <span class="ruby-keyword kw">end</span>
278
+ </pre>
279
+ </div>
280
+ </div>
281
+ </div>
282
+
283
+ <div id="method-M000035" class="method-detail">
284
+ <a name="M000035"></a>
285
+
286
+ <div class="method-heading">
287
+ <a href="#M000035" class="method-signature">
288
+ <span class="method-name">to_xml</span><span class="method-args">()</span>
289
+ </a>
290
+ </div>
291
+
292
+ <div class="method-description">
293
+ <p>
294
+ convert to a REXML::Document (properly namespaced)
295
+ </p>
296
+ <p><a class="source-toggle" href="#"
297
+ onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
298
+ <div class="method-source-code" id="M000035-source">
299
+ <pre>
300
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 183</span>
301
+ 183: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_xml</span>
302
+ 184: <span class="ruby-identifier">doc</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Document</span>.<span class="ruby-identifier">new</span>
303
+ 185: <span class="ruby-identifier">root</span> = <span class="ruby-identifier">to_element</span>
304
+ 186: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">add_namespace</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">NS</span>
305
+ 187: <span class="ruby-identifier">doc</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">root</span>
306
+ 188: <span class="ruby-identifier">doc</span>
307
+ 189: <span class="ruby-keyword kw">end</span>
308
+ </pre>
309
+ </div>
310
+ </div>
311
+ </div>
312
+
313
+
314
+ </div>
315
+
316
+
317
+ </div>
318
+
319
+
320
+ <div id="validator-badges">
321
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
322
+ </div>
323
+
324
+ </body>
325
+ </html>
@@ -0,0 +1,365 @@
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: Atom::Entry</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">Atom::Entry</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/atom/yaml_rb.html">
59
+ lib/atom/yaml.rb
60
+ </a>
61
+ <br />
62
+ <a href="../../files/lib/atom/app_rb.html">
63
+ lib/atom/app.rb
64
+ </a>
65
+ <br />
66
+ <a href="../../files/lib/atom/entry_rb.html">
67
+ lib/atom/entry.rb
68
+ </a>
69
+ <br />
70
+ </td>
71
+ </tr>
72
+
73
+ <tr class="top-aligned-row">
74
+ <td><strong>Parent:</strong></td>
75
+ <td>
76
+ Object
77
+ </td>
78
+ </tr>
79
+ </table>
80
+ </div>
81
+ <!-- banner header -->
82
+
83
+ <div id="bodyContent">
84
+
85
+
86
+
87
+ <div id="contextContent">
88
+
89
+ <div id="description">
90
+ <p>
91
+ An individual entry in a feed. As an <a
92
+ href="Element.html">Atom::Element</a>, it can be manipulated using
93
+ accessors for each of its child elements. You should be able to set them
94
+ using an instance of any class that makes sense
95
+ </p>
96
+ <p>
97
+ Entries have the following children:
98
+ </p>
99
+ <table>
100
+ <tr><td valign="top">id:</td><td>a universally unique IRI which permanently identifies the entry
101
+
102
+ </td></tr>
103
+ <tr><td valign="top">title:</td><td>a human-readable title (<a href="Text.html">Atom::Text</a>)
104
+
105
+ </td></tr>
106
+ <tr><td valign="top">content:</td><td>contains or links to the content of an entry (<a
107
+ href="Content.html">Atom::Content</a>)
108
+
109
+ </td></tr>
110
+ <tr><td valign="top">rights:</td><td>information about rights held in and over an entry (<a
111
+ href="Text.html">Atom::Text</a>)
112
+
113
+ </td></tr>
114
+ <tr><td valign="top">source:</td><td>the source feed&#8217;s metadata (unimplemented)
115
+
116
+ </td></tr>
117
+ <tr><td valign="top">published:</td><td>a Time &quot;early in the life cycle of an entry&quot;
118
+
119
+ </td></tr>
120
+ <tr><td valign="top">updated:</td><td>the most recent Time an entry was modified in a way the publisher considers
121
+ significant
122
+
123
+ </td></tr>
124
+ <tr><td valign="top">summary:</td><td>a summary, abstract or excerpt of an entry (<a
125
+ href="Text.html">Atom::Text</a>)
126
+
127
+ </td></tr>
128
+ </table>
129
+ <p>
130
+ There are also <tt>categories</tt>, <tt>links</tt>, <tt>authors</tt> and
131
+ <tt>contributors</tt>, each of which is an Array of its respective type and
132
+ can be used thusly:
133
+ </p>
134
+ <pre>
135
+ author = entry.authors.new
136
+ author.name = &quot;Captain Kangaroo&quot;
137
+ </pre>
138
+
139
+ </div>
140
+
141
+
142
+ </div>
143
+
144
+ <div id="method-list">
145
+ <h3 class="section-bar">Methods</h3>
146
+
147
+ <div class="name-list">
148
+ <a href="#M000002">edit_url</a>&nbsp;&nbsp;
149
+ <a href="#M000001">from_yaml</a>&nbsp;&nbsp;
150
+ <a href="#M000003">parse</a>&nbsp;&nbsp;
151
+ <a href="#M000005">tag_with</a>&nbsp;&nbsp;
152
+ <a href="#M000004">updated!</a>&nbsp;&nbsp;
153
+ </div>
154
+ </div>
155
+
156
+ </div>
157
+
158
+
159
+ <!-- if includes -->
160
+
161
+ <div id="section">
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+ <!-- if method_list -->
171
+ <div id="methods">
172
+ <h3 class="section-bar">Public Class methods</h3>
173
+
174
+ <div id="method-M000001" class="method-detail">
175
+ <a name="M000001"></a>
176
+
177
+ <div class="method-heading">
178
+ <a href="#M000001" class="method-signature">
179
+ <span class="method-name">from_yaml</span><span class="method-args">(yaml)</span>
180
+ </a>
181
+ </div>
182
+
183
+ <div class="method-description">
184
+ <p>
185
+ parses an <a href="Entry.html">Atom::Entry</a> from YAML
186
+ </p>
187
+ <p><a class="source-toggle" href="#"
188
+ onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
189
+ <div class="method-source-code" id="M000001-source">
190
+ <pre>
191
+ <span class="ruby-comment cmt"># File lib/atom/yaml.rb, line 67</span>
192
+ 67: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">from_yaml</span> <span class="ruby-identifier">yaml</span>
193
+ 68: <span class="ruby-identifier">hash</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">yaml</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Hash</span>); <span class="ruby-identifier">yaml</span> <span class="ruby-keyword kw">else</span> <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">yaml</span>); <span class="ruby-keyword kw">end</span>
194
+ 69:
195
+ 70: <span class="ruby-identifier">entry</span> = <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">Entry</span>.<span class="ruby-identifier">new</span>
196
+ 71:
197
+ 72: <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">title</span> = <span class="ruby-identifier">hash</span>[<span class="ruby-value str">&quot;title&quot;</span>]
198
+ 73: <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">summary</span> = <span class="ruby-identifier">hash</span>[<span class="ruby-value str">&quot;summary&quot;</span>]
199
+ 74:
200
+ 75: <span class="ruby-identifier">elem_constructs</span> = {<span class="ruby-value str">&quot;authors&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">authors</span>, <span class="ruby-value str">&quot;contributors&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">contributors</span>, <span class="ruby-value str">&quot;links&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">links</span>, <span class="ruby-value str">&quot;categories&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">categories</span>}
201
+ 76:
202
+ 77: <span class="ruby-identifier">elem_constructs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span>,<span class="ruby-identifier">ary</span><span class="ruby-operator">|</span>
203
+ 78: <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">type</span>] <span class="ruby-operator">||=</span> []
204
+ 79:
205
+ 80: <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">type</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">yelem</span><span class="ruby-operator">|</span>
206
+ 81: <span class="ruby-identifier">elem</span> = <span class="ruby-identifier">ary</span>.<span class="ruby-identifier">new</span>
207
+ 82:
208
+ 83: <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attrb</span>,<span class="ruby-identifier">req</span><span class="ruby-operator">|</span>
209
+ 84: <span class="ruby-identifier">elem</span>[<span class="ruby-identifier">attrb</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">yelem</span>[<span class="ruby-identifier">attrb</span>.<span class="ruby-identifier">to_s</span>]
210
+ 85: <span class="ruby-keyword kw">end</span>
211
+ 86:
212
+ 87: <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">elements</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>,<span class="ruby-identifier">kind</span>,<span class="ruby-identifier">req</span><span class="ruby-operator">|</span>
213
+ 88: <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;#{name}=&quot;</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-identifier">yelem</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>])
214
+ 89: <span class="ruby-keyword kw">end</span>
215
+ 90: <span class="ruby-keyword kw">end</span>
216
+ 91: <span class="ruby-keyword kw">end</span>
217
+ 92:
218
+ 93: <span class="ruby-comment cmt"># this adds more categories, and could cause conflicts</span>
219
+ 94: <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">tag_with</span> <span class="ruby-identifier">hash</span>[<span class="ruby-value str">&quot;tags&quot;</span>]
220
+ 95: <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">content</span> = <span class="ruby-identifier">hash</span>[<span class="ruby-value str">&quot;content&quot;</span>]
221
+ 96: <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">content</span>[<span class="ruby-value str">&quot;type&quot;</span>] = <span class="ruby-identifier">hash</span>[<span class="ruby-value str">&quot;type&quot;</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>[<span class="ruby-value str">&quot;type&quot;</span>]
222
+ 97:
223
+ 98: <span class="ruby-identifier">entry</span>
224
+ 99: <span class="ruby-keyword kw">end</span>
225
+ </pre>
226
+ </div>
227
+ </div>
228
+ </div>
229
+
230
+ <div id="method-M000003" class="method-detail">
231
+ <a name="M000003"></a>
232
+
233
+ <div class="method-heading">
234
+ <a href="#M000003" class="method-signature">
235
+ <span class="method-name">parse</span><span class="method-args">(xml, base = &quot;&quot;)</span>
236
+ </a>
237
+ </div>
238
+
239
+ <div class="method-description">
240
+ <p>
241
+ parses XML fetched from <tt>base</tt> into an <a
242
+ href="Entry.html">Atom::Entry</a>
243
+ </p>
244
+ <p><a class="source-toggle" href="#"
245
+ onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
246
+ <div class="method-source-code" id="M000003-source">
247
+ <pre>
248
+ <span class="ruby-comment cmt"># File lib/atom/entry.rb, line 59</span>
249
+ 59: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span> <span class="ruby-identifier">xml</span>, <span class="ruby-identifier">base</span> = <span class="ruby-value str">&quot;&quot;</span>
250
+ 60: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:to_atom_entry</span>
251
+ 61: <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">to_atom_entry</span>(<span class="ruby-identifier">base</span>)
252
+ 62: <span class="ruby-keyword kw">else</span>
253
+ 63: <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Document</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">xml</span>.<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">to_atom_entry</span>(<span class="ruby-identifier">base</span>)
254
+ 64: <span class="ruby-keyword kw">end</span>
255
+ 65: <span class="ruby-keyword kw">end</span>
256
+ </pre>
257
+ </div>
258
+ </div>
259
+ </div>
260
+
261
+ <h3 class="section-bar">Public Instance methods</h3>
262
+
263
+ <div id="method-M000002" class="method-detail">
264
+ <a name="M000002"></a>
265
+
266
+ <div class="method-heading">
267
+ <a href="#M000002" class="method-signature">
268
+ <span class="method-name">edit_url</span><span class="method-args">()</span>
269
+ </a>
270
+ </div>
271
+
272
+ <div class="method-description">
273
+ <p>
274
+ the @href of an entry&#8217;s link[@rel=&quot;edit&quot;]
275
+ </p>
276
+ <p><a class="source-toggle" href="#"
277
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
278
+ <div class="method-source-code" id="M000002-source">
279
+ <pre>
280
+ <span class="ruby-comment cmt"># File lib/atom/app.rb, line 75</span>
281
+ 75: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">edit_url</span>
282
+ 76: <span class="ruby-keyword kw">begin</span>
283
+ 77: <span class="ruby-identifier">edit_link</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">links</span>.<span class="ruby-identifier">find</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">link</span><span class="ruby-operator">|</span>
284
+ 78: <span class="ruby-identifier">link</span>[<span class="ruby-value str">&quot;rel&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;edit&quot;</span>
285
+ 79: <span class="ruby-keyword kw">end</span>
286
+ 80:
287
+ 81: <span class="ruby-identifier">edit_link</span>[<span class="ruby-value str">&quot;href&quot;</span>]
288
+ 82: <span class="ruby-keyword kw">rescue</span>
289
+ 83: <span class="ruby-keyword kw">nil</span>
290
+ 84: <span class="ruby-keyword kw">end</span>
291
+ 85: <span class="ruby-keyword kw">end</span>
292
+ </pre>
293
+ </div>
294
+ </div>
295
+ </div>
296
+
297
+ <div id="method-M000005" class="method-detail">
298
+ <a name="M000005"></a>
299
+
300
+ <div class="method-heading">
301
+ <a href="#M000005" class="method-signature">
302
+ <span class="method-name">tag_with</span><span class="method-args">(string)</span>
303
+ </a>
304
+ </div>
305
+
306
+ <div class="method-description">
307
+ <p>
308
+ categorize the entry based on a space-separated string
309
+ </p>
310
+ <p><a class="source-toggle" href="#"
311
+ onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
312
+ <div class="method-source-code" id="M000005-source">
313
+ <pre>
314
+ <span class="ruby-comment cmt"># File lib/atom/entry.rb, line 77</span>
315
+ 77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tag_with</span> <span class="ruby-identifier">string</span>
316
+ 78: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">nil?</span>
317
+ 79:
318
+ 80: <span class="ruby-identifier">string</span>.<span class="ruby-identifier">split</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tag</span><span class="ruby-operator">|</span>
319
+ 81: <span class="ruby-identifier">categories</span>.<span class="ruby-identifier">new</span>[<span class="ruby-value str">&quot;term&quot;</span>] = <span class="ruby-identifier">tag</span>
320
+ 82: <span class="ruby-keyword kw">end</span>
321
+ 83: <span class="ruby-keyword kw">end</span>
322
+ </pre>
323
+ </div>
324
+ </div>
325
+ </div>
326
+
327
+ <div id="method-M000004" class="method-detail">
328
+ <a name="M000004"></a>
329
+
330
+ <div class="method-heading">
331
+ <a href="#M000004" class="method-signature">
332
+ <span class="method-name">updated!</span><span class="method-args">()</span>
333
+ </a>
334
+ </div>
335
+
336
+ <div class="method-description">
337
+ <p>
338
+ declare that this entry has updated
339
+ </p>
340
+ <p><a class="source-toggle" href="#"
341
+ onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
342
+ <div class="method-source-code" id="M000004-source">
343
+ <pre>
344
+ <span class="ruby-comment cmt"># File lib/atom/entry.rb, line 72</span>
345
+ 72: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">updated!</span>
346
+ 73: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">updated</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
347
+ 74: <span class="ruby-keyword kw">end</span>
348
+ </pre>
349
+ </div>
350
+ </div>
351
+ </div>
352
+
353
+
354
+ </div>
355
+
356
+
357
+ </div>
358
+
359
+
360
+ <div id="validator-badges">
361
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
362
+ </div>
363
+
364
+ </body>
365
+ </html>