atom-tools 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. data/Rakefile +1 -1
  2. data/doc/classes/Atom/Author.html +130 -0
  3. data/doc/classes/Atom/Category.html +128 -0
  4. data/doc/classes/Atom/Collection.html +322 -0
  5. data/doc/classes/Atom/Content.html +129 -0
  6. data/doc/classes/Atom/Contributor.html +119 -0
  7. data/doc/classes/Atom/DigestAuth.html +285 -0
  8. data/doc/classes/Atom/Element.html +325 -0
  9. data/doc/classes/Atom/Entry.html +369 -0
  10. data/doc/classes/Atom/Feed.html +595 -0
  11. data/doc/classes/Atom/HTTP.html +436 -0
  12. data/doc/classes/Atom/HTTPResponse.html +149 -0
  13. data/doc/classes/Atom/Link.html +137 -0
  14. data/doc/classes/Atom/Service.html +260 -0
  15. data/doc/classes/Atom/Text.html +245 -0
  16. data/doc/classes/Atom/Workspace.html +121 -0
  17. data/doc/classes/XHTML.html +118 -0
  18. data/doc/created.rid +1 -0
  19. data/doc/files/README.html +213 -0
  20. data/doc/files/lib/atom/collection_rb.html +110 -0
  21. data/doc/files/lib/atom/element_rb.html +109 -0
  22. data/doc/files/lib/atom/entry_rb.html +111 -0
  23. data/doc/files/lib/atom/feed_rb.html +112 -0
  24. data/doc/files/lib/atom/http_rb.html +112 -0
  25. data/doc/files/lib/atom/service_rb.html +111 -0
  26. data/doc/files/lib/atom/text_rb.html +109 -0
  27. data/doc/files/lib/atom/xml_rb.html +110 -0
  28. data/doc/files/lib/atom/yaml_rb.html +109 -0
  29. data/doc/fr_class_index.html +42 -0
  30. data/doc/fr_file_index.html +36 -0
  31. data/doc/fr_method_index.html +69 -0
  32. data/doc/index.html +24 -0
  33. data/doc/rdoc-style.css +208 -0
  34. data/lib/atom/collection.rb +0 -21
  35. data/lib/atom/entry.rb +13 -0
  36. data/lib/atom/feed.rb +6 -7
  37. data/lib/atom/http.rb +97 -19
  38. data/lib/atom/service.rb +2 -22
  39. data/lib/atom/yaml.rb +1 -1
  40. data/test/test_feed.rb +27 -4
  41. data/test/test_http.rb +153 -34
  42. metadata +39 -2
@@ -0,0 +1,137 @@
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::Link</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::Link</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
+ Atom::AttrEl
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <p>
83
+ A link has the following attributes:
84
+ </p>
85
+ <table>
86
+ <tr><td valign="top">href (required):</td><td>the link&#8216;s IRI
87
+
88
+ </td></tr>
89
+ <tr><td valign="top">rel:</td><td>the relationship of the linked item to the current item
90
+
91
+ </td></tr>
92
+ <tr><td valign="top">type:</td><td>a hint about the media type of the linked item
93
+
94
+ </td></tr>
95
+ <tr><td valign="top">hreflang:</td><td>the language of the linked item (RFC3066)
96
+
97
+ </td></tr>
98
+ <tr><td valign="top">title:</td><td>human-readable information about the link
99
+
100
+ </td></tr>
101
+ <tr><td valign="top">length:</td><td>a hint about the length (in octets) of the linked item
102
+
103
+ </td></tr>
104
+ </table>
105
+
106
+ </div>
107
+
108
+
109
+ </div>
110
+
111
+
112
+ </div>
113
+
114
+
115
+ <!-- if includes -->
116
+
117
+ <div id="section">
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+ <!-- if method_list -->
127
+
128
+
129
+ </div>
130
+
131
+
132
+ <div id="validator-badges">
133
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
134
+ </div>
135
+
136
+ </body>
137
+ </html>
@@ -0,0 +1,260 @@
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::Service</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::Service</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/atom/service_rb.html">
59
+ lib/atom/service.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ <a href="Element.html">
69
+ Atom::Element
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+ <div id="description">
84
+ <p>
85
+ <a href="Service.html">Atom::Service</a> represents an Atom Publishing
86
+ Protocol service document. Its only child is workspaces, which is an Array
87
+ of <a href="Workspace.html">Atom::Workspace</a> s
88
+ </p>
89
+
90
+ </div>
91
+
92
+
93
+ </div>
94
+
95
+ <div id="method-list">
96
+ <h3 class="section-bar">Methods</h3>
97
+
98
+ <div class="name-list">
99
+ <a href="#M000036">new</a>&nbsp;&nbsp;
100
+ <a href="#M000037">parse</a>&nbsp;&nbsp;
101
+ <a href="#M000038">to_xml</a>&nbsp;&nbsp;
102
+ </div>
103
+ </div>
104
+
105
+ </div>
106
+
107
+
108
+ <!-- if includes -->
109
+
110
+ <div id="section">
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+ <!-- if method_list -->
120
+ <div id="methods">
121
+ <h3 class="section-bar">Public Class methods</h3>
122
+
123
+ <div id="method-M000036" class="method-detail">
124
+ <a name="M000036"></a>
125
+
126
+ <div class="method-heading">
127
+ <a href="#M000036" class="method-signature">
128
+ <span class="method-name">new</span><span class="method-args">(service_url = &quot;&quot;, http = Atom::HTTP.new)</span>
129
+ </a>
130
+ </div>
131
+
132
+ <div class="method-description">
133
+ <p>
134
+ retrieves and parses an Atom service document.
135
+ </p>
136
+ <p><a class="source-toggle" href="#"
137
+ onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
138
+ <div class="method-source-code" id="M000036-source">
139
+ <pre>
140
+ <span class="ruby-comment cmt"># File lib/atom/service.rb, line 92</span>
141
+ 92: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">service_url</span> = <span class="ruby-value str">&quot;&quot;</span>, <span class="ruby-identifier">http</span> = <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</span>)
142
+ 93: <span class="ruby-keyword kw">super</span>(<span class="ruby-value str">&quot;service&quot;</span>)
143
+ 94:
144
+ 95: <span class="ruby-ivar">@http</span> = <span class="ruby-identifier">http</span>
145
+ 96:
146
+ 97: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">service_url</span>.<span class="ruby-identifier">empty?</span>
147
+ 98:
148
+ 99: <span class="ruby-identifier">base</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">service_url</span>)
149
+ 100:
150
+ 101: <span class="ruby-identifier">rxml</span> = <span class="ruby-keyword kw">nil</span>
151
+ 102:
152
+ 103: <span class="ruby-identifier">res</span> = <span class="ruby-ivar">@http</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">base</span>, <span class="ruby-value str">&quot;Accept&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;application/atomserv+xml&quot;</span>)
153
+ 104: <span class="ruby-identifier">res</span>.<span class="ruby-identifier">validate_content_type</span>([<span class="ruby-value str">&quot;application/atomserv+xml&quot;</span>])
154
+ 105:
155
+ 106: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;200&quot;</span> <span class="ruby-comment cmt"># XXX needs to handle redirects, &amp;c.</span>
156
+ 107: <span class="ruby-identifier">raise</span> <span class="ruby-constant">WrongResponse</span>, <span class="ruby-node">&quot;service document URL responded with unexpected code #{res.code}&quot;</span>
157
+ 108: <span class="ruby-keyword kw">end</span>
158
+ 109:
159
+ 110: <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">res</span>.<span class="ruby-identifier">body</span>, <span class="ruby-identifier">base</span>)
160
+ 111: <span class="ruby-keyword kw">end</span>
161
+ </pre>
162
+ </div>
163
+ </div>
164
+ </div>
165
+
166
+ <h3 class="section-bar">Public Instance methods</h3>
167
+
168
+ <div id="method-M000037" class="method-detail">
169
+ <a name="M000037"></a>
170
+
171
+ <div class="method-heading">
172
+ <a href="#M000037" class="method-signature">
173
+ <span class="method-name">parse</span><span class="method-args">(xml, base = &quot;&quot;)</span>
174
+ </a>
175
+ </div>
176
+
177
+ <div class="method-description">
178
+ <p>
179
+ <a href="Service.html#M000037">parse</a> a service document, adding its
180
+ workspaces to this object
181
+ </p>
182
+ <p><a class="source-toggle" href="#"
183
+ onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
184
+ <div class="method-source-code" id="M000037-source">
185
+ <pre>
186
+ <span class="ruby-comment cmt"># File lib/atom/service.rb, line 114</span>
187
+ 114: <span class="ruby-keyword kw">def</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>
188
+ 115: <span class="ruby-identifier">rxml</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Document</span>
189
+ 116: <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">root</span>
190
+ 117: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Element</span>
191
+ 118: <span class="ruby-identifier">xml</span>
192
+ 119: <span class="ruby-keyword kw">else</span>
193
+ 120: <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>)
194
+ 121: <span class="ruby-keyword kw">end</span>
195
+ 122:
196
+ 123: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">rxml</span>.<span class="ruby-identifier">root</span>.<span class="ruby-identifier">namespace</span> <span class="ruby-operator">==</span> <span class="ruby-constant">PP_NS</span>
197
+ 124: <span class="ruby-identifier">raise</span> <span class="ruby-constant">WrongNamespace</span>, <span class="ruby-value str">&quot;this isn't an atom service document!&quot;</span>
198
+ 125: <span class="ruby-keyword kw">end</span>
199
+ 126:
200
+ 127: <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">rxml</span>, <span class="ruby-value str">&quot;/app:service/app:workspace&quot;</span>, {<span class="ruby-value str">&quot;app&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">PP_NS</span>} ).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ws_el</span><span class="ruby-operator">|</span>
201
+ 128: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">workspaces</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">Workspace</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">ws_el</span>, <span class="ruby-identifier">base</span>, <span class="ruby-ivar">@http</span>)
202
+ 129: <span class="ruby-keyword kw">end</span>
203
+ 130:
204
+ 131: <span class="ruby-keyword kw">self</span>
205
+ 132: <span class="ruby-keyword kw">end</span>
206
+ </pre>
207
+ </div>
208
+ </div>
209
+ </div>
210
+
211
+ <div id="method-M000038" class="method-detail">
212
+ <a name="M000038"></a>
213
+
214
+ <div class="method-heading">
215
+ <a href="#M000038" class="method-signature">
216
+ <span class="method-name">to_xml</span><span class="method-args">()</span>
217
+ </a>
218
+ </div>
219
+
220
+ <div class="method-description">
221
+ <p>
222
+ serialize to a (namespaced) REXML::Document
223
+ </p>
224
+ <p><a class="source-toggle" href="#"
225
+ onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
226
+ <div class="method-source-code" id="M000038-source">
227
+ <pre>
228
+ <span class="ruby-comment cmt"># File lib/atom/service.rb, line 135</span>
229
+ 135: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_xml</span>
230
+ 136: <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>
231
+ 137:
232
+ 138: <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-value str">&quot;service&quot;</span>
233
+ 139: <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">PP_NS</span>
234
+ 140: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">add_namespace</span> <span class="ruby-value str">&quot;atom&quot;</span>, <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">NS</span>
235
+ 141:
236
+ 142: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">workspaces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ws</span><span class="ruby-operator">|</span>
237
+ 143: <span class="ruby-identifier">root</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">ws</span>.<span class="ruby-identifier">to_element</span>
238
+ 144: <span class="ruby-keyword kw">end</span>
239
+ 145:
240
+ 146: <span class="ruby-identifier">doc</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">root</span>
241
+ 147: <span class="ruby-identifier">doc</span>
242
+ 148: <span class="ruby-keyword kw">end</span>
243
+ </pre>
244
+ </div>
245
+ </div>
246
+ </div>
247
+
248
+
249
+ </div>
250
+
251
+
252
+ </div>
253
+
254
+
255
+ <div id="validator-badges">
256
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
257
+ </div>
258
+
259
+ </body>
260
+ </html>
@@ -0,0 +1,245 @@
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::Text</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::Text</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/text_rb.html">
63
+ lib/atom/text.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
+ <a href="Element.html">
73
+ Atom::Element
74
+ </a>
75
+ </td>
76
+ </tr>
77
+ </table>
78
+ </div>
79
+ <!-- banner header -->
80
+
81
+ <div id="bodyContent">
82
+
83
+
84
+
85
+ <div id="contextContent">
86
+
87
+ <div id="description">
88
+ <p>
89
+ An <a href="Element.html">Atom::Element</a> representing a text construct.
90
+ It has a single attribute, &quot;type&quot;, which accepts values
91
+ &quot;text&quot;, &quot;<a href="Text.html#M000021">html</a>&quot; and
92
+ &quot;xhtml&quot;
93
+ </p>
94
+
95
+ </div>
96
+
97
+
98
+ </div>
99
+
100
+ <div id="method-list">
101
+ <h3 class="section-bar">Methods</h3>
102
+
103
+ <div class="name-list">
104
+ <a href="#M000021">html</a>&nbsp;&nbsp;
105
+ <a href="#M000020">to_s</a>&nbsp;&nbsp;
106
+ <a href="#M000022">xml</a>&nbsp;&nbsp;
107
+ </div>
108
+ </div>
109
+
110
+ </div>
111
+
112
+
113
+ <!-- if includes -->
114
+
115
+ <div id="section">
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ <!-- if method_list -->
125
+ <div id="methods">
126
+ <h3 class="section-bar">Public Instance methods</h3>
127
+
128
+ <div id="method-M000021" class="method-detail">
129
+ <a name="M000021"></a>
130
+
131
+ <div class="method-heading">
132
+ <a href="#M000021" class="method-signature">
133
+ <span class="method-name">html</span><span class="method-args">()</span>
134
+ </a>
135
+ </div>
136
+
137
+ <div class="method-description">
138
+ <p>
139
+ returns a string suitable for dumping into an HTML document
140
+ </p>
141
+ <p><a class="source-toggle" href="#"
142
+ onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
143
+ <div class="method-source-code" id="M000021-source">
144
+ <pre>
145
+ <span class="ruby-comment cmt"># File lib/atom/text.rb, line 32</span>
146
+ 32: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">html</span>
147
+ 33: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;xhtml&quot;</span> <span class="ruby-keyword kw">or</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;html&quot;</span>
148
+ 34: <span class="ruby-identifier">to_s</span>
149
+ 35: <span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;text&quot;</span>
150
+ 36: <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Text</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">to_s</span>
151
+ 37: <span class="ruby-keyword kw">end</span>
152
+ 38: <span class="ruby-keyword kw">end</span>
153
+ </pre>
154
+ </div>
155
+ </div>
156
+ </div>
157
+
158
+ <div id="method-M000020" class="method-detail">
159
+ <a name="M000020"></a>
160
+
161
+ <div class="method-heading">
162
+ <a href="#M000020" class="method-signature">
163
+ <span class="method-name">to_s</span><span class="method-args">()</span>
164
+ </a>
165
+ </div>
166
+
167
+ <div class="method-description">
168
+ <p><a class="source-toggle" href="#"
169
+ onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
170
+ <div class="method-source-code" id="M000020-source">
171
+ <pre>
172
+ <span class="ruby-comment cmt"># File lib/atom/text.rb, line 23</span>
173
+ 23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
174
+ 24: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;xhtml&quot;</span>
175
+ 25: <span class="ruby-ivar">@content</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">to_s</span>
176
+ 26: <span class="ruby-keyword kw">else</span>
177
+ 27: <span class="ruby-ivar">@content</span>.<span class="ruby-identifier">to_s</span>
178
+ 28: <span class="ruby-keyword kw">end</span>
179
+ 29: <span class="ruby-keyword kw">end</span>
180
+ </pre>
181
+ </div>
182
+ </div>
183
+ </div>
184
+
185
+ <div id="method-M000022" class="method-detail">
186
+ <a name="M000022"></a>
187
+
188
+ <div class="method-heading">
189
+ <a href="#M000022" class="method-signature">
190
+ <span class="method-name">xml</span><span class="method-args">()</span>
191
+ </a>
192
+ </div>
193
+
194
+ <div class="method-description">
195
+ <p>
196
+ attempts to parse the content of this element as XML and return it as an
197
+ array of REXML::Elements.
198
+ </p>
199
+ <p>
200
+ If this self[&quot;type&quot;] is &quot;<a
201
+ href="Text.html#M000021">html</a>&quot; and Hpricot is installed, it will
202
+ be converted to <a href="../XHTML.html">XHTML</a> first.
203
+ </p>
204
+ <p><a class="source-toggle" href="#"
205
+ onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
206
+ <div class="method-source-code" id="M000022-source">
207
+ <pre>
208
+ <span class="ruby-comment cmt"># File lib/atom/text.rb, line 45</span>
209
+ 45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xml</span>
210
+ 46: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;xhtml&quot;</span>
211
+ 47: <span class="ruby-ivar">@content</span>.<span class="ruby-identifier">children</span>
212
+ 48: <span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;text&quot;</span>
213
+ 49: [<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>]
214
+ 50: <span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;html&quot;</span>
215
+ 51: <span class="ruby-keyword kw">begin</span>
216
+ 52: <span class="ruby-identifier">require</span> <span class="ruby-value str">&quot;hpricot&quot;</span>
217
+ 53: <span class="ruby-keyword kw">rescue</span>
218
+ 54: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Turning HTML content into XML requires Hpricot.&quot;</span>
219
+ 55: <span class="ruby-keyword kw">end</span>
220
+ 56:
221
+ 57: <span class="ruby-identifier">fixed</span> = <span class="ruby-constant">Hpricot</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">:xhtml_strict</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>)
222
+ 58: <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-node">&quot;&lt;div&gt;#{fixed}&lt;/div&gt;&quot;</span>).<span class="ruby-identifier">root</span>.<span class="ruby-identifier">children</span>
223
+ 59: <span class="ruby-keyword kw">else</span>
224
+ 60: <span class="ruby-comment cmt"># XXX check that @type is an XML mimetype and parse it</span>
225
+ 61: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;I haven't implemented this yet&quot;</span>
226
+ 62: <span class="ruby-keyword kw">end</span>
227
+ 63: <span class="ruby-keyword kw">end</span>
228
+ </pre>
229
+ </div>
230
+ </div>
231
+ </div>
232
+
233
+
234
+ </div>
235
+
236
+
237
+ </div>
238
+
239
+
240
+ <div id="validator-badges">
241
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
242
+ </div>
243
+
244
+ </body>
245
+ </html>