atom-tools 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/Rakefile +1 -1
  2. data/doc/classes/Atom/AttrEl.html +163 -0
  3. data/doc/classes/Atom/Author.html +113 -0
  4. data/doc/classes/Atom/AutodiscoveryFailure.html +111 -0
  5. data/doc/classes/Atom/Categories.html +168 -0
  6. data/doc/classes/Atom/Category.html +137 -0
  7. data/doc/classes/Atom/Collection.html +425 -0
  8. data/doc/classes/Atom/Content.html +170 -0
  9. data/doc/classes/Atom/Contributor.html +113 -0
  10. data/doc/classes/Atom/Control.html +126 -0
  11. data/doc/classes/Atom/Converters.html +571 -0
  12. data/doc/classes/Atom/DigestAuth.html +285 -0
  13. data/doc/classes/Atom/Element.html +892 -0
  14. data/doc/classes/Atom/FileCache.html +287 -0
  15. data/doc/classes/Atom/HTTP.html +490 -0
  16. data/doc/classes/Atom/HTTPResponse.html +190 -0
  17. data/doc/classes/Atom/HasCategories.html +187 -0
  18. data/doc/classes/Atom/HasLinks.html +168 -0
  19. data/doc/classes/Atom/Link.html +214 -0
  20. data/doc/classes/Atom/NilCache.html +202 -0
  21. data/doc/classes/Atom/ParseError.html +111 -0
  22. data/doc/classes/Atom/Parsers.html +311 -0
  23. data/doc/classes/Atom/Person.html +130 -0
  24. data/doc/classes/Atom/Rights.html +113 -0
  25. data/doc/classes/Atom/Service.html +298 -0
  26. data/doc/classes/Atom/Source.html +111 -0
  27. data/doc/classes/Atom/Subtitle.html +113 -0
  28. data/doc/classes/Atom/Summary.html +113 -0
  29. data/doc/classes/Atom/Text.html +372 -0
  30. data/doc/classes/Atom/Title.html +113 -0
  31. data/doc/classes/Atom/Tools.html +525 -0
  32. data/doc/classes/Atom/Workspace.html +121 -0
  33. data/doc/classes/Object.html +204 -0
  34. data/doc/classes/XHTML.html +118 -0
  35. data/doc/created.rid +1 -0
  36. data/doc/files/README.html +173 -0
  37. data/doc/files/lib/atom/cache_rb.html +302 -0
  38. data/doc/files/lib/atom/collection_rb.html +109 -0
  39. data/doc/files/lib/atom/element_rb.html +110 -0
  40. data/doc/files/lib/atom/entry_rb.html +111 -0
  41. data/doc/files/lib/atom/feed_rb.html +111 -0
  42. data/doc/files/lib/atom/http_rb.html +114 -0
  43. data/doc/files/lib/atom/service_rb.html +112 -0
  44. data/doc/files/lib/atom/text_rb.html +109 -0
  45. data/doc/files/lib/atom/tools_rb.html +108 -0
  46. data/doc/fr_class_index.html +59 -0
  47. data/doc/fr_file_index.html +36 -0
  48. data/doc/fr_method_index.html +137 -0
  49. data/doc/index.html +24 -0
  50. data/doc/rdoc-style.css +208 -0
  51. data/lib/atom/cache.rb +1 -1
  52. data/lib/atom/http.rb +2 -2
  53. data/lib/atom/text.rb +15 -6
  54. data/spec/entry_spec.rb +12 -1
  55. data/spec/feed_spec.rb +20 -1
  56. data/spec/fixtures/contacts-feed.xml +34 -0
  57. data/spec/fixtures/entry-w-xml.xml +24 -0
  58. metadata +68 -5
@@ -0,0 +1,285 @@
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>Module: Atom::DigestAuth</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>Module</strong></td>
53
+ <td class="class-name-in-header">Atom::DigestAuth</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/atom/http_rb.html">
59
+ lib/atom/http.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000022">digest_authenticate</a>&nbsp;&nbsp;
84
+ <a href="#M000020">h</a>&nbsp;&nbsp;
85
+ <a href="#M000021">kd</a>&nbsp;&nbsp;
86
+ <a href="#M000019">parse_wwwauth_digest</a>&nbsp;&nbsp;
87
+ </div>
88
+ </div>
89
+
90
+ </div>
91
+
92
+
93
+ <!-- if includes -->
94
+
95
+ <div id="section">
96
+
97
+
98
+ <div id="constants-list">
99
+ <h3 class="section-bar">Constants</h3>
100
+
101
+ <div class="name-list">
102
+ <table summary="Constants">
103
+ <tr class="top-aligned-row context-row">
104
+ <td class="context-item-name">CNONCE</td>
105
+ <td>=</td>
106
+ <td class="context-item-value">Digest::MD5.hexdigest(&quot;%x&quot; % (Time.now.to_i + rand(65535)))</td>
107
+ </tr>
108
+ </table>
109
+ </div>
110
+ </div>
111
+
112
+
113
+
114
+
115
+
116
+
117
+ <!-- if method_list -->
118
+ <div id="methods">
119
+ <h3 class="section-bar">Public Instance methods</h3>
120
+
121
+ <div id="method-M000022" class="method-detail">
122
+ <a name="M000022"></a>
123
+
124
+ <div class="method-heading">
125
+ <a href="#M000022" class="method-signature">
126
+ <span class="method-name">digest_authenticate</span><span class="method-args">(req, url, param_string = &quot;&quot;)</span>
127
+ </a>
128
+ </div>
129
+
130
+ <div class="method-description">
131
+ <p>
132
+ <a href="HTTP.html">HTTP</a> Digest authentication (RFC 2617)
133
+ </p>
134
+ <p><a class="source-toggle" href="#"
135
+ onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
136
+ <div class="method-source-code" id="M000022-source">
137
+ <pre>
138
+ <span class="ruby-comment cmt"># File lib/atom/http.rb, line 47</span>
139
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">digest_authenticate</span>(<span class="ruby-identifier">req</span>, <span class="ruby-identifier">url</span>, <span class="ruby-identifier">param_string</span> = <span class="ruby-value str">&quot;&quot;</span>)
140
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Digest authentication requires a WWW-Authenticate header&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">param_string</span>.<span class="ruby-identifier">empty?</span>
141
+
142
+ <span class="ruby-identifier">params</span> = <span class="ruby-identifier">parse_wwwauth_digest</span>(<span class="ruby-identifier">param_string</span>)
143
+ <span class="ruby-identifier">qop</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:qop</span>]
144
+
145
+ <span class="ruby-identifier">user</span>, <span class="ruby-identifier">pass</span> = <span class="ruby-identifier">username_and_password_for_realm</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:realm</span>])
146
+
147
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:algorithm</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;MD5&quot;</span>
148
+ <span class="ruby-identifier">a1</span> = <span class="ruby-identifier">user</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:realm</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">pass</span>
149
+ <span class="ruby-keyword kw">else</span>
150
+ <span class="ruby-comment cmt"># XXX MD5-sess</span>
151
+ <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;I only support MD5 digest authentication (not #{params[:algorithm].inspect})&quot;</span>
152
+ <span class="ruby-keyword kw">end</span>
153
+
154
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">qop</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">qop</span>.<span class="ruby-identifier">member?</span> <span class="ruby-value str">&quot;auth&quot;</span>
155
+ <span class="ruby-identifier">a2</span> = <span class="ruby-identifier">req</span>.<span class="ruby-identifier">method</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">req</span>.<span class="ruby-identifier">path</span>
156
+ <span class="ruby-keyword kw">else</span>
157
+ <span class="ruby-comment cmt"># XXX auth-int</span>
158
+ <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;only 'auth' qop supported (none of: #{qop.inspect})&quot;</span>
159
+ <span class="ruby-keyword kw">end</span>
160
+
161
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">qop</span>.<span class="ruby-identifier">nil?</span>
162
+ <span class="ruby-identifier">response</span> = <span class="ruby-identifier">kd</span>(<span class="ruby-identifier">h</span>(<span class="ruby-identifier">a1</span>), <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:nonce</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">h</span>(<span class="ruby-identifier">a2</span>))
163
+ <span class="ruby-keyword kw">else</span>
164
+ <span class="ruby-ivar">@@nonce_count</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
165
+ <span class="ruby-identifier">nc</span> = (<span class="ruby-value str">'%08x'</span> <span class="ruby-operator">%</span> <span class="ruby-ivar">@@nonce_count</span>)
166
+
167
+ <span class="ruby-comment cmt"># XXX auth-int</span>
168
+ <span class="ruby-identifier">data</span> = <span class="ruby-node">&quot;#{params[:nonce]}:#{nc}:#{CNONCE}:#{&quot;auth&quot;}:#{h(a2)}&quot;</span>
169
+
170
+ <span class="ruby-identifier">response</span> = <span class="ruby-identifier">kd</span>(<span class="ruby-identifier">h</span>(<span class="ruby-identifier">a1</span>), <span class="ruby-identifier">data</span>)
171
+ <span class="ruby-keyword kw">end</span>
172
+
173
+ <span class="ruby-identifier">header</span> = <span class="ruby-node">%Q&lt;Digest username=&quot;#{user}&quot;, uri=&quot;#{req.path}&quot;, realm=&quot;#{params[:realm]}&quot;, response=&quot;#{response}&quot;, nonce=&quot;#{params[:nonce]}&quot;&gt;</span>
174
+
175
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:opaque</span>]
176
+ <span class="ruby-identifier">header</span> <span class="ruby-operator">+=</span> <span class="ruby-node">%Q&lt;, opaque=&quot;#{params[:opaque]}&quot;&gt;</span>
177
+ <span class="ruby-keyword kw">end</span>
178
+
179
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:algorithm</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">&quot;MD5&quot;</span>
180
+ <span class="ruby-identifier">header</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;, algorithm=#{algo}&quot;</span>
181
+ <span class="ruby-keyword kw">end</span>
182
+
183
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">qop</span>
184
+ <span class="ruby-comment cmt"># XXX auth-int</span>
185
+ <span class="ruby-identifier">header</span> <span class="ruby-operator">+=</span> <span class="ruby-node">%Q&lt;, nc=#{nc}, cnonce=&quot;#{CNONCE}&quot;, qop=auth&gt;</span>
186
+ <span class="ruby-keyword kw">end</span>
187
+
188
+ <span class="ruby-identifier">req</span>[<span class="ruby-value str">&quot;Authorization&quot;</span>] = <span class="ruby-identifier">header</span>
189
+ <span class="ruby-keyword kw">end</span>
190
+ </pre>
191
+ </div>
192
+ </div>
193
+ </div>
194
+
195
+ <div id="method-M000020" class="method-detail">
196
+ <a name="M000020"></a>
197
+
198
+ <div class="method-heading">
199
+ <a href="#M000020" class="method-signature">
200
+ <span class="method-name">h</span><span class="method-args">(data)</span>
201
+ </a>
202
+ </div>
203
+
204
+ <div class="method-description">
205
+ <p><a class="source-toggle" href="#"
206
+ onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
207
+ <div class="method-source-code" id="M000020-source">
208
+ <pre>
209
+ <span class="ruby-comment cmt"># File lib/atom/http.rb, line 43</span>
210
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">h</span>(<span class="ruby-identifier">data</span>); <span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">MD5</span>.<span class="ruby-identifier">hexdigest</span>(<span class="ruby-identifier">data</span>); <span class="ruby-keyword kw">end</span>
211
+ </pre>
212
+ </div>
213
+ </div>
214
+ </div>
215
+
216
+ <div id="method-M000021" class="method-detail">
217
+ <a name="M000021"></a>
218
+
219
+ <div class="method-heading">
220
+ <a href="#M000021" class="method-signature">
221
+ <span class="method-name">kd</span><span class="method-args">(secret, data)</span>
222
+ </a>
223
+ </div>
224
+
225
+ <div class="method-description">
226
+ <p><a class="source-toggle" href="#"
227
+ onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
228
+ <div class="method-source-code" id="M000021-source">
229
+ <pre>
230
+ <span class="ruby-comment cmt"># File lib/atom/http.rb, line 44</span>
231
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">kd</span>(<span class="ruby-identifier">secret</span>, <span class="ruby-identifier">data</span>); <span class="ruby-identifier">h</span>(<span class="ruby-identifier">secret</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">data</span>); <span class="ruby-keyword kw">end</span>
232
+ </pre>
233
+ </div>
234
+ </div>
235
+ </div>
236
+
237
+ <div id="method-M000019" class="method-detail">
238
+ <a name="M000019"></a>
239
+
240
+ <div class="method-heading">
241
+ <a href="#M000019" class="method-signature">
242
+ <span class="method-name">parse_wwwauth_digest</span><span class="method-args">(param_string)</span>
243
+ </a>
244
+ </div>
245
+
246
+ <div class="method-description">
247
+ <p>
248
+ quoted-strings plus a few special cases for Digest
249
+ </p>
250
+ <p><a class="source-toggle" href="#"
251
+ onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
252
+ <div class="method-source-code" id="M000019-source">
253
+ <pre>
254
+ <span class="ruby-comment cmt"># File lib/atom/http.rb, line 29</span>
255
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_wwwauth_digest</span> <span class="ruby-identifier">param_string</span>
256
+ <span class="ruby-identifier">params</span> = <span class="ruby-identifier">parse_quoted_wwwauth</span> <span class="ruby-identifier">param_string</span>
257
+ <span class="ruby-identifier">qop</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:qop</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:qop</span>].<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;,&quot;</span>) <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
258
+
259
+ <span class="ruby-identifier">param_string</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/stale=([^,]*)/</span>) <span class="ruby-keyword kw">do</span>
260
+ <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:stale</span>] = (<span class="ruby-identifier">$1</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;true&quot;</span>)
261
+ <span class="ruby-keyword kw">end</span>
262
+
263
+ <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:algorithm</span>] = <span class="ruby-value str">&quot;MD5&quot;</span>
264
+ <span class="ruby-identifier">param_string</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/algorithm=([^,]*)/</span>) { <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:algorithm</span>] = <span class="ruby-identifier">$1</span> }
265
+
266
+ <span class="ruby-identifier">params</span>
267
+ <span class="ruby-keyword kw">end</span>
268
+ </pre>
269
+ </div>
270
+ </div>
271
+ </div>
272
+
273
+
274
+ </div>
275
+
276
+
277
+ </div>
278
+
279
+
280
+ <div id="validator-badges">
281
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
282
+ </div>
283
+
284
+ </body>
285
+ </html>
@@ -0,0 +1,892 @@
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/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="../Object.html">
69
+ Object
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
+ The Class&#8217; methods provide a DSL for describing Atom&#8216;s
86
+ structure
87
+ </p>
88
+ <pre>
89
+ (and more generally for describing simple namespaced XML)
90
+ </pre>
91
+
92
+ </div>
93
+
94
+
95
+ </div>
96
+
97
+ <div id="method-list">
98
+ <h3 class="section-bar">Methods</h3>
99
+
100
+ <div class="name-list">
101
+ <a href="#M000095">append_elem</a>&nbsp;&nbsp;
102
+ <a href="#M000088">build</a>&nbsp;&nbsp;
103
+ <a href="#M000085">builders</a>&nbsp;&nbsp;
104
+ <a href="#M000090">def_get</a>&nbsp;&nbsp;
105
+ <a href="#M000091">def_set</a>&nbsp;&nbsp;
106
+ <a href="#M000084">do_parsing</a>&nbsp;&nbsp;
107
+ <a href="#M000096">get</a>&nbsp;&nbsp;
108
+ <a href="#M000081">get_atom_attrb</a>&nbsp;&nbsp;
109
+ <a href="#M000079">get_atom_elem</a>&nbsp;&nbsp;
110
+ <a href="#M000080">get_atom_elems</a>&nbsp;&nbsp;
111
+ <a href="#M000077">get_elem</a>&nbsp;&nbsp;
112
+ <a href="#M000078">get_elems</a>&nbsp;&nbsp;
113
+ <a href="#M000076">is_atom_element</a>&nbsp;&nbsp;
114
+ <a href="#M000075">is_element</a>&nbsp;&nbsp;
115
+ <a href="#M000092">new</a>&nbsp;&nbsp;
116
+ <a href="#M000083">on_build</a>&nbsp;&nbsp;
117
+ <a href="#M000093">on_init</a>&nbsp;&nbsp;
118
+ <a href="#M000086">parse</a>&nbsp;&nbsp;
119
+ <a href="#M000094">run_initters</a>&nbsp;&nbsp;
120
+ <a href="#M000097">set</a>&nbsp;&nbsp;
121
+ <a href="#M000082">set_atom_attrb</a>&nbsp;&nbsp;
122
+ <a href="#M000089">to_s</a>&nbsp;&nbsp;
123
+ <a href="#M000087">to_xml</a>&nbsp;&nbsp;
124
+ </div>
125
+ </div>
126
+
127
+ </div>
128
+
129
+
130
+ <!-- if includes -->
131
+
132
+ <div id="section">
133
+
134
+
135
+
136
+
137
+
138
+ <div id="attribute-list">
139
+ <h3 class="section-bar">Attributes</h3>
140
+
141
+ <div class="name-list">
142
+ <table>
143
+ <tr class="top-aligned-row context-row">
144
+ <td class="context-item-name">base</td>
145
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
146
+ <td class="context-item-desc">
147
+ this element&#8216;s xml:base
148
+
149
+ </td>
150
+ </tr>
151
+ <tr class="top-aligned-row context-row">
152
+ <td class="context-item-name">extensions</td>
153
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
154
+ <td class="context-item-desc">
155
+ xml elements and attributes that have been parsed, but are unknown
156
+
157
+ </td>
158
+ </tr>
159
+ </table>
160
+ </div>
161
+ </div>
162
+
163
+
164
+
165
+ <!-- if method_list -->
166
+ <div id="methods">
167
+ <h3 class="section-bar">Public Class methods</h3>
168
+
169
+ <div id="method-M000085" class="method-detail">
170
+ <a name="M000085"></a>
171
+
172
+ <div class="method-heading">
173
+ <a href="#M000085" class="method-signature">
174
+ <span class="method-name">builders</span><span class="method-args">(&amp;block)</span>
175
+ </a>
176
+ </div>
177
+
178
+ <div class="method-description">
179
+ <p><a class="source-toggle" href="#"
180
+ onclick="toggleCode('M000085-source');return false;">[Source]</a></p>
181
+ <div class="method-source-code" id="M000085-source">
182
+ <pre>
183
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 396</span>
184
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">builders</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
185
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ancestors</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:builders</span>
186
+ <span class="ruby-identifier">ancestors</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">builders</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
187
+ <span class="ruby-keyword kw">end</span>
188
+
189
+ <span class="ruby-ivar">@on_build</span> <span class="ruby-operator">||=</span> []
190
+ <span class="ruby-ivar">@on_build</span>.<span class="ruby-identifier">each</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
191
+ <span class="ruby-keyword kw">end</span>
192
+ </pre>
193
+ </div>
194
+ </div>
195
+ </div>
196
+
197
+ <div id="method-M000090" class="method-detail">
198
+ <a name="M000090"></a>
199
+
200
+ <div class="method-heading">
201
+ <a href="#M000090" class="method-signature">
202
+ <span class="method-name">def_get</span><span class="method-args">(name, &amp;block)</span>
203
+ </a>
204
+ </div>
205
+
206
+ <div class="method-description">
207
+ <p>
208
+ defines a getter that calls &#8216;block&#8216;
209
+ </p>
210
+ <p><a class="source-toggle" href="#"
211
+ onclick="toggleCode('M000090-source');return false;">[Source]</a></p>
212
+ <div class="method-source-code" id="M000090-source">
213
+ <pre>
214
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 492</span>
215
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">def_get</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
216
+ <span class="ruby-identifier">define_method</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
217
+ <span class="ruby-keyword kw">end</span>
218
+ </pre>
219
+ </div>
220
+ </div>
221
+ </div>
222
+
223
+ <div id="method-M000091" class="method-detail">
224
+ <a name="M000091"></a>
225
+
226
+ <div class="method-heading">
227
+ <a href="#M000091" class="method-signature">
228
+ <span class="method-name">def_set</span><span class="method-args">(name, &amp;block)</span>
229
+ </a>
230
+ </div>
231
+
232
+ <div class="method-description">
233
+ <p>
234
+ defines a setter that calls &#8216;block&#8216;
235
+ </p>
236
+ <p><a class="source-toggle" href="#"
237
+ onclick="toggleCode('M000091-source');return false;">[Source]</a></p>
238
+ <div class="method-source-code" id="M000091-source">
239
+ <pre>
240
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 497</span>
241
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">def_set</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
242
+ <span class="ruby-identifier">define_method</span> <span class="ruby-node">&quot;#{name}=&quot;</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
243
+ <span class="ruby-keyword kw">end</span>
244
+ </pre>
245
+ </div>
246
+ </div>
247
+ </div>
248
+
249
+ <div id="method-M000084" class="method-detail">
250
+ <a name="M000084"></a>
251
+
252
+ <div class="method-heading">
253
+ <a href="#M000084" class="method-signature">
254
+ <span class="method-name">do_parsing</span><span class="method-args">(e, root)</span>
255
+ </a>
256
+ </div>
257
+
258
+ <div class="method-description">
259
+ <p><a class="source-toggle" href="#"
260
+ onclick="toggleCode('M000084-source');return false;">[Source]</a></p>
261
+ <div class="method-source-code" id="M000084-source">
262
+ <pre>
263
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 387</span>
264
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">do_parsing</span> <span class="ruby-identifier">e</span>, <span class="ruby-identifier">root</span>
265
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ancestors</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:do_parsing</span>
266
+ <span class="ruby-identifier">ancestors</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">do_parsing</span> <span class="ruby-identifier">e</span>, <span class="ruby-identifier">root</span>
267
+ <span class="ruby-keyword kw">end</span>
268
+
269
+ <span class="ruby-ivar">@on_parse</span> <span class="ruby-operator">||=</span> []
270
+ <span class="ruby-ivar">@on_parse</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">e</span>, <span class="ruby-identifier">root</span> }
271
+ <span class="ruby-keyword kw">end</span>
272
+ </pre>
273
+ </div>
274
+ </div>
275
+ </div>
276
+
277
+ <div id="method-M000076" class="method-detail">
278
+ <a name="M000076"></a>
279
+
280
+ <div class="method-heading">
281
+ <a href="#M000076" class="method-signature">
282
+ <span class="method-name">is_atom_element</span><span class="method-args">(name)</span>
283
+ </a>
284
+ </div>
285
+
286
+ <div class="method-description">
287
+ <p>
288
+ wrapper for <a href="Element.html#M000075">is_element</a>
289
+ </p>
290
+ <p><a class="source-toggle" href="#"
291
+ onclick="toggleCode('M000076-source');return false;">[Source]</a></p>
292
+ <div class="method-source-code" id="M000076-source">
293
+ <pre>
294
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 345</span>
295
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">is_atom_element</span> <span class="ruby-identifier">name</span>
296
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">is_element</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">NS</span>, <span class="ruby-identifier">name</span>
297
+ <span class="ruby-keyword kw">end</span>
298
+ </pre>
299
+ </div>
300
+ </div>
301
+ </div>
302
+
303
+ <div id="method-M000075" class="method-detail">
304
+ <a name="M000075"></a>
305
+
306
+ <div class="method-heading">
307
+ <a href="#M000075" class="method-signature">
308
+ <span class="method-name">is_element</span><span class="method-args">(ns, name)</span>
309
+ </a>
310
+ </div>
311
+
312
+ <div class="method-description">
313
+ <p>
314
+ attaches a name and a namespace to an element this needs to be called on
315
+ any <a href="Element.html#M000092">new</a> element
316
+ </p>
317
+ <p><a class="source-toggle" href="#"
318
+ onclick="toggleCode('M000075-source');return false;">[Source]</a></p>
319
+ <div class="method-source-code" id="M000075-source">
320
+ <pre>
321
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 339</span>
322
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">is_element</span> <span class="ruby-identifier">ns</span>, <span class="ruby-identifier">name</span>
323
+ <span class="ruby-identifier">meta_def</span> <span class="ruby-identifier">:self_namespace</span> <span class="ruby-keyword kw">do</span>; <span class="ruby-identifier">ns</span>; <span class="ruby-keyword kw">end</span>
324
+ <span class="ruby-identifier">meta_def</span> <span class="ruby-identifier">:self_name</span> <span class="ruby-keyword kw">do</span>; <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>; <span class="ruby-keyword kw">end</span>
325
+ <span class="ruby-keyword kw">end</span>
326
+ </pre>
327
+ </div>
328
+ </div>
329
+ </div>
330
+
331
+ <div id="method-M000092" class="method-detail">
332
+ <a name="M000092"></a>
333
+
334
+ <div class="method-heading">
335
+ <a href="#M000092" class="method-signature">
336
+ <span class="method-name">new</span><span class="method-args">(defaults = {})</span>
337
+ </a>
338
+ </div>
339
+
340
+ <div class="method-description">
341
+ <p>
342
+ be sure to call super if you override this method!
343
+ </p>
344
+ <p><a class="source-toggle" href="#"
345
+ onclick="toggleCode('M000092-source');return false;">[Source]</a></p>
346
+ <div class="method-source-code" id="M000092-source">
347
+ <pre>
348
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 502</span>
349
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">defaults</span> = {}
350
+ <span class="ruby-ivar">@extensions</span> = []
351
+
352
+ <span class="ruby-ivar">@extensions</span>.<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-value str">'@attrs'</span>, {})
353
+ <span class="ruby-keyword kw">def</span> <span class="ruby-ivar">@extensions</span>.<span class="ruby-identifier">attributes</span>
354
+ <span class="ruby-ivar">@attrs</span>
355
+ <span class="ruby-keyword kw">end</span>
356
+
357
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">run_initters</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">init</span><span class="ruby-operator">|</span>
358
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">init</span>
359
+ <span class="ruby-keyword kw">end</span>
360
+
361
+ <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
362
+ <span class="ruby-identifier">set</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>)
363
+ <span class="ruby-keyword kw">end</span>
364
+ <span class="ruby-keyword kw">end</span>
365
+ </pre>
366
+ </div>
367
+ </div>
368
+ </div>
369
+
370
+ <div id="method-M000083" class="method-detail">
371
+ <a name="M000083"></a>
372
+
373
+ <div class="method-heading">
374
+ <a href="#M000083" class="method-signature">
375
+ <span class="method-name">on_build</span><span class="method-args">(&amp;block)</span>
376
+ </a>
377
+ </div>
378
+
379
+ <div class="method-description">
380
+ <p><a class="source-toggle" href="#"
381
+ onclick="toggleCode('M000083-source');return false;">[Source]</a></p>
382
+ <div class="method-source-code" id="M000083-source">
383
+ <pre>
384
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 382</span>
385
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">on_build</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
386
+ <span class="ruby-ivar">@on_build</span> <span class="ruby-operator">||=</span> []
387
+ <span class="ruby-ivar">@on_build</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">block</span>
388
+ <span class="ruby-keyword kw">end</span>
389
+ </pre>
390
+ </div>
391
+ </div>
392
+ </div>
393
+
394
+ <div id="method-M000093" class="method-detail">
395
+ <a name="M000093"></a>
396
+
397
+ <div class="method-heading">
398
+ <a href="#M000093" class="method-signature">
399
+ <span class="method-name">on_init</span><span class="method-args">(&amp;block)</span>
400
+ </a>
401
+ </div>
402
+
403
+ <div class="method-description">
404
+ <p><a class="source-toggle" href="#"
405
+ onclick="toggleCode('M000093-source');return false;">[Source]</a></p>
406
+ <div class="method-source-code" id="M000093-source">
407
+ <pre>
408
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 519</span>
409
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span><span class="ruby-keyword kw">self</span>..<span class="ruby-identifier">on_init</span><span class="ruby-identifier">on_init</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
410
+ <span class="ruby-ivar">@on_init</span> <span class="ruby-operator">||=</span> []
411
+ <span class="ruby-ivar">@on_init</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">block</span>
412
+ <span class="ruby-keyword kw">end</span>
413
+ </pre>
414
+ </div>
415
+ </div>
416
+ </div>
417
+
418
+ <div id="method-M000086" class="method-detail">
419
+ <a name="M000086"></a>
420
+
421
+ <div class="method-heading">
422
+ <a href="#M000086" class="method-signature">
423
+ <span class="method-name">parse</span><span class="method-args">(xml, base = '', element = nil)</span>
424
+ </a>
425
+ </div>
426
+
427
+ <div class="method-description">
428
+ <p>
429
+ turns a String, an IO-like, a REXML::Element, etc. into an <a
430
+ href="Element.html">Atom::Element</a>
431
+ </p>
432
+ <p>
433
+ the &#8216;base&#8217; base URL parameter should be supplied if you know
434
+ where this XML was fetched from
435
+ </p>
436
+ <p>
437
+ if you want to <a href="Element.html#M000086">parse</a> into an existing <a
438
+ href="Element.html">Atom::Element</a>, it can be passed in as
439
+ &#8216;element&#8216;
440
+ </p>
441
+ <p><a class="source-toggle" href="#"
442
+ onclick="toggleCode('M000086-source');return false;">[Source]</a></p>
443
+ <div class="method-source-code" id="M000086-source">
444
+ <pre>
445
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 412</span>
446
+ <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">''</span>, <span class="ruby-identifier">element</span> = <span class="ruby-keyword kw">nil</span>
447
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:elements</span>
448
+ <span class="ruby-identifier">root</span> = <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">dup</span>
449
+ <span class="ruby-keyword kw">else</span>
450
+ <span class="ruby-identifier">xml</span> = <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">read</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:read</span>
451
+
452
+ <span class="ruby-keyword kw">begin</span>
453
+ <span class="ruby-identifier">root</span> = <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">root</span>
454
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">ParseException</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
455
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">ParseError</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
456
+ <span class="ruby-keyword kw">end</span>
457
+ <span class="ruby-keyword kw">end</span>
458
+
459
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">root</span>.<span class="ruby-identifier">local_name</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">self_name</span>
460
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">ParseError</span>, <span class="ruby-node">&quot;expected element named #{self.self_name}, not #{root.local_name}&quot;</span>
461
+ <span class="ruby-keyword kw">end</span>
462
+
463
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">root</span>.<span class="ruby-identifier">namespace</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">self_namespace</span>
464
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">ParseError</span>, <span class="ruby-node">&quot;expected element in namespace #{self.self_namespace}, not #{root.namespace}&quot;</span>
465
+ <span class="ruby-keyword kw">end</span>
466
+
467
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">root</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">'xml:base'</span>]
468
+ <span class="ruby-identifier">base</span> = (<span class="ruby-identifier">base</span>.<span class="ruby-identifier">to_uri</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">root</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">'xml:base'</span>])
469
+ <span class="ruby-keyword kw">end</span>
470
+
471
+ <span class="ruby-identifier">e</span> = <span class="ruby-identifier">element</span> <span class="ruby-value">? </span><span class="ruby-identifier">element</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>
472
+ <span class="ruby-identifier">e</span>.<span class="ruby-identifier">base</span> = <span class="ruby-identifier">base</span>
473
+
474
+ <span class="ruby-comment cmt"># extension elements</span>
475
+ <span class="ruby-identifier">root</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">c</span><span class="ruby-operator">|</span>
476
+ <span class="ruby-identifier">e</span>.<span class="ruby-identifier">extensions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">c</span>
477
+ <span class="ruby-keyword kw">end</span>
478
+
479
+ <span class="ruby-comment cmt"># extension attributes</span>
480
+ <span class="ruby-identifier">root</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
481
+ <span class="ruby-identifier">e</span>.<span class="ruby-identifier">extensions</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
482
+ <span class="ruby-keyword kw">end</span>
483
+
484
+ <span class="ruby-comment cmt"># as things are parsed, they're removed from e.extensions. whatever's</span>
485
+ <span class="ruby-comment cmt"># left over is stored so it can be round-tripped</span>
486
+
487
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">do_parsing</span> <span class="ruby-identifier">e</span>, <span class="ruby-identifier">root</span>
488
+
489
+ <span class="ruby-identifier">e</span>
490
+ <span class="ruby-keyword kw">end</span>
491
+ </pre>
492
+ </div>
493
+ </div>
494
+ </div>
495
+
496
+ <div id="method-M000094" class="method-detail">
497
+ <a name="M000094"></a>
498
+
499
+ <div class="method-heading">
500
+ <a href="#M000094" class="method-signature">
501
+ <span class="method-name">run_initters</span><span class="method-args">(&amp;block)</span>
502
+ </a>
503
+ </div>
504
+
505
+ <div class="method-description">
506
+ <p><a class="source-toggle" href="#"
507
+ onclick="toggleCode('M000094-source');return false;">[Source]</a></p>
508
+ <div class="method-source-code" id="M000094-source">
509
+ <pre>
510
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 524</span>
511
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">run_initters</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
512
+ <span class="ruby-ivar">@on_init</span>.<span class="ruby-identifier">each</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@on_init</span>
513
+ <span class="ruby-keyword kw">end</span>
514
+ </pre>
515
+ </div>
516
+ </div>
517
+ </div>
518
+
519
+ <h3 class="section-bar">Public Instance methods</h3>
520
+
521
+ <div id="method-M000095" class="method-detail">
522
+ <a name="M000095"></a>
523
+
524
+ <div class="method-heading">
525
+ <a href="#M000095" class="method-signature">
526
+ <span class="method-name">append_elem</span><span class="method-args">(root, ns, name)</span>
527
+ </a>
528
+ </div>
529
+
530
+ <div class="method-description">
531
+ <p>
532
+ appends an element named &#8216;name&#8217; in namespace &#8216;ns&#8217;
533
+ to &#8216;root&#8217; ns is either [prefix, namespace] or just a String
534
+ containing the namespace
535
+ </p>
536
+ <p><a class="source-toggle" href="#"
537
+ onclick="toggleCode('M000095-source');return false;">[Source]</a></p>
538
+ <div class="method-source-code" id="M000095-source">
539
+ <pre>
540
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 530</span>
541
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">append_elem</span>(<span class="ruby-identifier">root</span>, <span class="ruby-identifier">ns</span>, <span class="ruby-identifier">name</span>)
542
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ns</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Array</span>
543
+ <span class="ruby-identifier">prefix</span>, <span class="ruby-identifier">uri</span> = <span class="ruby-identifier">ns</span>
544
+ <span class="ruby-keyword kw">else</span>
545
+ <span class="ruby-identifier">prefix</span>, <span class="ruby-identifier">uri</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">ns</span>
546
+ <span class="ruby-keyword kw">end</span>
547
+
548
+ <span class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>
549
+
550
+ <span class="ruby-identifier">existing_prefix</span> = <span class="ruby-identifier">root</span>.<span class="ruby-identifier">namespaces</span>.<span class="ruby-identifier">find</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
551
+ <span class="ruby-identifier">v</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>
552
+ <span class="ruby-keyword kw">end</span>
553
+
554
+ <span class="ruby-identifier">root</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">existing_prefix</span>
555
+ <span class="ruby-identifier">prefix</span> = <span class="ruby-identifier">existing_prefix</span>[<span class="ruby-value">0</span>]
556
+
557
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">prefix</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'xmlns'</span>
558
+ <span class="ruby-identifier">name</span> = <span class="ruby-identifier">prefix</span> <span class="ruby-operator">+</span> <span class="ruby-value str">':'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">name</span>
559
+ <span class="ruby-keyword kw">end</span>
560
+
561
+ <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>)
562
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">prefix</span>
563
+ <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">prefix</span> <span class="ruby-operator">+</span> <span class="ruby-value str">':'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">name</span>)
564
+ <span class="ruby-identifier">e</span>.<span class="ruby-identifier">add_namespace</span>(<span class="ruby-identifier">prefix</span>, <span class="ruby-identifier">uri</span>)
565
+ <span class="ruby-identifier">e</span>
566
+ <span class="ruby-keyword kw">else</span>
567
+ <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>)
568
+ <span class="ruby-identifier">e</span>.<span class="ruby-identifier">add_namespace</span>(<span class="ruby-identifier">uri</span>)
569
+ <span class="ruby-identifier">e</span>
570
+ <span class="ruby-keyword kw">end</span>
571
+ <span class="ruby-keyword kw">end</span>
572
+ </pre>
573
+ </div>
574
+ </div>
575
+ </div>
576
+
577
+ <div id="method-M000088" class="method-detail">
578
+ <a name="M000088"></a>
579
+
580
+ <div class="method-heading">
581
+ <a href="#M000088" class="method-signature">
582
+ <span class="method-name">build</span><span class="method-args">(root)</span>
583
+ </a>
584
+ </div>
585
+
586
+ <div class="method-description">
587
+ <p>
588
+ fill a REXML::Element with the data from this <a
589
+ href="Element.html">Atom::Element</a>
590
+ </p>
591
+ <p><a class="source-toggle" href="#"
592
+ onclick="toggleCode('M000088-source');return false;">[Source]</a></p>
593
+ <div class="method-source-code" id="M000088-source">
594
+ <pre>
595
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 469</span>
596
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build</span> <span class="ruby-identifier">root</span>
597
+ <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>
598
+ <span class="ruby-identifier">root</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">'xml:base'</span>] = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">base</span>
599
+ <span class="ruby-keyword kw">end</span>
600
+
601
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">builders</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">builder</span><span class="ruby-operator">|</span>
602
+ <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">call</span> <span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">root</span>
603
+ <span class="ruby-keyword kw">end</span>
604
+
605
+ <span class="ruby-ivar">@extensions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
606
+ <span class="ruby-identifier">root</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">dup</span>
607
+ <span class="ruby-keyword kw">end</span>
608
+
609
+ <span class="ruby-ivar">@extensions</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
610
+ <span class="ruby-identifier">root</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
611
+ <span class="ruby-keyword kw">end</span>
612
+ <span class="ruby-keyword kw">end</span>
613
+ </pre>
614
+ </div>
615
+ </div>
616
+ </div>
617
+
618
+ <div id="method-M000096" class="method-detail">
619
+ <a name="M000096"></a>
620
+
621
+ <div class="method-heading">
622
+ <a href="#M000096" class="method-signature">
623
+ <span class="method-name">get</span><span class="method-args">(name)</span>
624
+ </a>
625
+ </div>
626
+
627
+ <div class="method-description">
628
+ <p>
629
+ calls a getter
630
+ </p>
631
+ <p><a class="source-toggle" href="#"
632
+ onclick="toggleCode('M000096-source');return false;">[Source]</a></p>
633
+ <div class="method-source-code" id="M000096-source">
634
+ <pre>
635
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 567</span>
636
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span> <span class="ruby-identifier">name</span>
637
+ <span class="ruby-identifier">send</span> <span class="ruby-node">&quot;#{name}&quot;</span>.<span class="ruby-identifier">to_sym</span>
638
+ <span class="ruby-keyword kw">end</span>
639
+ </pre>
640
+ </div>
641
+ </div>
642
+ </div>
643
+
644
+ <div id="method-M000081" class="method-detail">
645
+ <a name="M000081"></a>
646
+
647
+ <div class="method-heading">
648
+ <a href="#M000081" class="method-signature">
649
+ <span class="method-name">get_atom_attrb</span><span class="method-args">(xml, name)</span>
650
+ </a>
651
+ </div>
652
+
653
+ <div class="method-description">
654
+ <p>
655
+ gets an attribute on <tt>xml</tt>
656
+ </p>
657
+ <p><a class="source-toggle" href="#"
658
+ onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
659
+ <div class="method-source-code" id="M000081-source">
660
+ <pre>
661
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 370</span>
662
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_atom_attrb</span> <span class="ruby-identifier">xml</span>, <span class="ruby-identifier">name</span>
663
+ <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>]
664
+ <span class="ruby-keyword kw">end</span>
665
+ </pre>
666
+ </div>
667
+ </div>
668
+ </div>
669
+
670
+ <div id="method-M000079" class="method-detail">
671
+ <a name="M000079"></a>
672
+
673
+ <div class="method-heading">
674
+ <a href="#M000079" class="method-signature">
675
+ <span class="method-name">get_atom_elem</span><span class="method-args">(xml, name)</span>
676
+ </a>
677
+ </div>
678
+
679
+ <div class="method-description">
680
+ <p>
681
+ gets a child element in the Atom namespace
682
+ </p>
683
+ <p><a class="source-toggle" href="#"
684
+ onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
685
+ <div class="method-source-code" id="M000079-source">
686
+ <pre>
687
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 360</span>
688
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_atom_elem</span> <span class="ruby-identifier">xml</span>, <span class="ruby-identifier">name</span>
689
+ <span class="ruby-identifier">get_elem</span> <span class="ruby-identifier">xml</span>, <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">NS</span>, <span class="ruby-identifier">name</span>
690
+ <span class="ruby-keyword kw">end</span>
691
+ </pre>
692
+ </div>
693
+ </div>
694
+ </div>
695
+
696
+ <div id="method-M000080" class="method-detail">
697
+ <a name="M000080"></a>
698
+
699
+ <div class="method-heading">
700
+ <a href="#M000080" class="method-signature">
701
+ <span class="method-name">get_atom_elems</span><span class="method-args">(xml, name)</span>
702
+ </a>
703
+ </div>
704
+
705
+ <div class="method-description">
706
+ <p>
707
+ gets multiple child elements in the Atom namespace
708
+ </p>
709
+ <p><a class="source-toggle" href="#"
710
+ onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
711
+ <div class="method-source-code" id="M000080-source">
712
+ <pre>
713
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 365</span>
714
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_atom_elems</span> <span class="ruby-identifier">xml</span>, <span class="ruby-identifier">name</span>
715
+ <span class="ruby-identifier">get_elems</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">NS</span>, <span class="ruby-identifier">name</span>
716
+ <span class="ruby-keyword kw">end</span>
717
+ </pre>
718
+ </div>
719
+ </div>
720
+ </div>
721
+
722
+ <div id="method-M000077" class="method-detail">
723
+ <a name="M000077"></a>
724
+
725
+ <div class="method-heading">
726
+ <a href="#M000077" class="method-signature">
727
+ <span class="method-name">get_elem</span><span class="method-args">(xml, ns, name)</span>
728
+ </a>
729
+ </div>
730
+
731
+ <div class="method-description">
732
+ <p>
733
+ gets a single namespaced child element
734
+ </p>
735
+ <p><a class="source-toggle" href="#"
736
+ onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
737
+ <div class="method-source-code" id="M000077-source">
738
+ <pre>
739
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 350</span>
740
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_elem</span> <span class="ruby-identifier">xml</span>, <span class="ruby-identifier">ns</span>, <span class="ruby-identifier">name</span>
741
+ <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span> <span class="ruby-identifier">xml</span>, <span class="ruby-node">&quot;./ns:#{name}&quot;</span>, { <span class="ruby-value str">'ns'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ns</span> }
742
+ <span class="ruby-keyword kw">end</span>
743
+ </pre>
744
+ </div>
745
+ </div>
746
+ </div>
747
+
748
+ <div id="method-M000078" class="method-detail">
749
+ <a name="M000078"></a>
750
+
751
+ <div class="method-heading">
752
+ <a href="#M000078" class="method-signature">
753
+ <span class="method-name">get_elems</span><span class="method-args">(xml, ns, name)</span>
754
+ </a>
755
+ </div>
756
+
757
+ <div class="method-description">
758
+ <p>
759
+ gets multiple namespaced child elements
760
+ </p>
761
+ <p><a class="source-toggle" href="#"
762
+ onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
763
+ <div class="method-source-code" id="M000078-source">
764
+ <pre>
765
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 355</span>
766
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_elems</span> <span class="ruby-identifier">xml</span>, <span class="ruby-identifier">ns</span>, <span class="ruby-identifier">name</span>
767
+ <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">match</span> <span class="ruby-identifier">xml</span>, <span class="ruby-node">&quot;./ns:#{name}&quot;</span>, { <span class="ruby-value str">'ns'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ns</span> }
768
+ <span class="ruby-keyword kw">end</span>
769
+ </pre>
770
+ </div>
771
+ </div>
772
+ </div>
773
+
774
+ <div id="method-M000097" class="method-detail">
775
+ <a name="M000097"></a>
776
+
777
+ <div class="method-heading">
778
+ <a href="#M000097" class="method-signature">
779
+ <span class="method-name">set</span><span class="method-args">(name, value)</span>
780
+ </a>
781
+ </div>
782
+
783
+ <div class="method-description">
784
+ <p>
785
+ calls a setter
786
+ </p>
787
+ <p><a class="source-toggle" href="#"
788
+ onclick="toggleCode('M000097-source');return false;">[Source]</a></p>
789
+ <div class="method-source-code" id="M000097-source">
790
+ <pre>
791
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 572</span>
792
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set</span> <span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>
793
+ <span class="ruby-identifier">send</span> <span class="ruby-node">&quot;#{name}=&quot;</span>, <span class="ruby-identifier">value</span>
794
+ <span class="ruby-keyword kw">end</span>
795
+ </pre>
796
+ </div>
797
+ </div>
798
+ </div>
799
+
800
+ <div id="method-M000082" class="method-detail">
801
+ <a name="M000082"></a>
802
+
803
+ <div class="method-heading">
804
+ <a href="#M000082" class="method-signature">
805
+ <span class="method-name">set_atom_attrb</span><span class="method-args">(xml, name, value)</span>
806
+ </a>
807
+ </div>
808
+
809
+ <div class="method-description">
810
+ <p>
811
+ sets an attribute on <tt>xml</tt>
812
+ </p>
813
+ <p><a class="source-toggle" href="#"
814
+ onclick="toggleCode('M000082-source');return false;">[Source]</a></p>
815
+ <div class="method-source-code" id="M000082-source">
816
+ <pre>
817
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 375</span>
818
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_atom_attrb</span> <span class="ruby-identifier">xml</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>
819
+ <span class="ruby-identifier">xml</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>
820
+ <span class="ruby-keyword kw">end</span>
821
+ </pre>
822
+ </div>
823
+ </div>
824
+ </div>
825
+
826
+ <div id="method-M000089" class="method-detail">
827
+ <a name="M000089"></a>
828
+
829
+ <div class="method-heading">
830
+ <a href="#M000089" class="method-signature">
831
+ <span class="method-name">to_s</span><span class="method-args">()</span>
832
+ </a>
833
+ </div>
834
+
835
+ <div class="method-description">
836
+ <p><a class="source-toggle" href="#"
837
+ onclick="toggleCode('M000089-source');return false;">[Source]</a></p>
838
+ <div class="method-source-code" id="M000089-source">
839
+ <pre>
840
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 487</span>
841
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
842
+ <span class="ruby-identifier">to_xml</span>.<span class="ruby-identifier">to_s</span>
843
+ <span class="ruby-keyword kw">end</span>
844
+ </pre>
845
+ </div>
846
+ </div>
847
+ </div>
848
+
849
+ <div id="method-M000087" class="method-detail">
850
+ <a name="M000087"></a>
851
+
852
+ <div class="method-heading">
853
+ <a href="#M000087" class="method-signature">
854
+ <span class="method-name">to_xml</span><span class="method-args">()</span>
855
+ </a>
856
+ </div>
857
+
858
+ <div class="method-description">
859
+ <p>
860
+ converts to a REXML::Element
861
+ </p>
862
+ <p><a class="source-toggle" href="#"
863
+ onclick="toggleCode('M000087-source');return false;">[Source]</a></p>
864
+ <div class="method-source-code" id="M000087-source">
865
+ <pre>
866
+ <span class="ruby-comment cmt"># File lib/atom/element.rb, line 459</span>
867
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_xml</span>
868
+ <span class="ruby-identifier">root</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-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">self_name</span>
869
+ <span class="ruby-identifier">root</span>.<span class="ruby-identifier">add_namespace</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">self_namespace</span>
870
+
871
+ <span class="ruby-identifier">build</span> <span class="ruby-identifier">root</span>
872
+
873
+ <span class="ruby-identifier">root</span>
874
+ <span class="ruby-keyword kw">end</span>
875
+ </pre>
876
+ </div>
877
+ </div>
878
+ </div>
879
+
880
+
881
+ </div>
882
+
883
+
884
+ </div>
885
+
886
+
887
+ <div id="validator-badges">
888
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
889
+ </div>
890
+
891
+ </body>
892
+ </html>