atom-tools 0.9.2 → 0.9.3

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