cft_smartcloud 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/README.rdoc +4 -0
  2. data/Rakefile +3 -3
  3. data/VERSION +1 -1
  4. data/bin/cft_smartcloud +37 -0
  5. data/cft_smartcloud.gemspec +88 -7
  6. data/lib/smartcloud.rb +12 -2
  7. data/lib/smartcloud_logger.rb +1 -1
  8. data/rdoc/classes/ConfigTable/BoolItem.html +172 -0
  9. data/rdoc/classes/ConfigTable/ExecItem.html +252 -0
  10. data/rdoc/classes/ConfigTable/Item.html +308 -0
  11. data/rdoc/classes/ConfigTable/MetaConfigEnvironment.html +445 -0
  12. data/rdoc/classes/ConfigTable/PackageSelectionItem.html +188 -0
  13. data/rdoc/classes/ConfigTable/PathItem.html +148 -0
  14. data/rdoc/classes/ConfigTable/ProgramItem.html +148 -0
  15. data/rdoc/classes/ConfigTable/SelectItem.html +175 -0
  16. data/rdoc/classes/ConfigTable.html +724 -0
  17. data/rdoc/classes/Enumerable.html +157 -0
  18. data/rdoc/classes/Errno/ENOTEMPTY.html +111 -0
  19. data/rdoc/classes/Errno.html +111 -0
  20. data/rdoc/classes/File.html +197 -0
  21. data/rdoc/classes/FileOperations.html +600 -0
  22. data/rdoc/classes/Hash.html +163 -0
  23. data/rdoc/classes/HookScriptAPI.html +413 -0
  24. data/rdoc/classes/IBMSmartCloud.html +1484 -0
  25. data/rdoc/classes/Installer/Shebang.html +245 -0
  26. data/rdoc/classes/Installer.html +1660 -0
  27. data/rdoc/classes/MIME/InvalidContentType.html +119 -0
  28. data/rdoc/classes/MIME/Type.html +1366 -0
  29. data/rdoc/classes/MIME/Types.html +643 -0
  30. data/rdoc/classes/MIME.html +124 -0
  31. data/rdoc/classes/MockSmartCloud.html +376 -0
  32. data/rdoc/classes/Net/HTTP.html +164 -0
  33. data/rdoc/classes/Net.html +122 -0
  34. data/rdoc/classes/RestClient/AbstractResponse.html +417 -0
  35. data/rdoc/classes/RestClient/Exception.html +305 -0
  36. data/rdoc/classes/RestClient/ExceptionWithResponse.html +119 -0
  37. data/rdoc/classes/RestClient/Exceptions.html +130 -0
  38. data/rdoc/classes/RestClient/MaxRedirectsReached.html +113 -0
  39. data/rdoc/classes/RestClient/Payload/Base.html +422 -0
  40. data/rdoc/classes/RestClient/Payload/Multipart.html +372 -0
  41. data/rdoc/classes/RestClient/Payload/Streamed.html +191 -0
  42. data/rdoc/classes/RestClient/Payload/UrlEncoded.html +202 -0
  43. data/rdoc/classes/RestClient/Payload.html +192 -0
  44. data/rdoc/classes/RestClient/RawResponse.html +236 -0
  45. data/rdoc/classes/RestClient/Redirect.html +168 -0
  46. data/rdoc/classes/RestClient/Request.html +950 -0
  47. data/rdoc/classes/RestClient/RequestFailed.html +178 -0
  48. data/rdoc/classes/RestClient/Resource.html +607 -0
  49. data/rdoc/classes/RestClient/Response.html +208 -0
  50. data/rdoc/classes/RestClient/ResponseForException.html +152 -0
  51. data/rdoc/classes/RestClient/SSLCertificateNotVerified.html +149 -0
  52. data/rdoc/classes/RestClient/ServerBrokeConnection.html +157 -0
  53. data/rdoc/classes/RestClient.html +737 -0
  54. data/rdoc/classes/SetupError.html +111 -0
  55. data/rdoc/classes/SmartcloudLogger.html +162 -0
  56. data/rdoc/classes/TestMIME.html +109 -0
  57. data/rdoc/classes/ToplevelInstaller.html +987 -0
  58. data/rdoc/classes/ToplevelInstallerMulti.html +593 -0
  59. data/rdoc/classes/XmlSimple/Cache.html +372 -0
  60. data/rdoc/classes/XmlSimple.html +475 -0
  61. data/rdoc/created.rid +1 -0
  62. data/rdoc/files/README_rdoc.html +198 -0
  63. data/rdoc/files/lib/hash_fix_rb.html +115 -0
  64. data/rdoc/files/lib/mime-types-1_16/lib/mime/types_rb.html +107 -0
  65. data/rdoc/files/lib/mime-types-1_16/setup_rb.html +157 -0
  66. data/rdoc/files/lib/mime-types-1_16/test/test_mime_type_rb.html +109 -0
  67. data/rdoc/files/lib/mime-types-1_16/test/test_mime_types_rb.html +109 -0
  68. data/rdoc/files/lib/mock_smartcloud_rb.html +115 -0
  69. data/rdoc/files/lib/rest-client-1_6_3/lib/rest-client_rb.html +107 -0
  70. data/rdoc/files/lib/rest-client-1_6_3/lib/rest_client_rb.html +108 -0
  71. data/rdoc/files/lib/rest-client-1_6_3/lib/restclient/abstract_response_rb.html +108 -0
  72. data/rdoc/files/lib/rest-client-1_6_3/lib/restclient/exceptions_rb.html +101 -0
  73. data/rdoc/files/lib/rest-client-1_6_3/lib/restclient/net_http_ext_rb.html +113 -0
  74. data/rdoc/files/lib/rest-client-1_6_3/lib/restclient/payload_rb.html +110 -0
  75. data/rdoc/files/lib/rest-client-1_6_3/lib/restclient/raw_response_rb.html +101 -0
  76. data/rdoc/files/lib/rest-client-1_6_3/lib/restclient/request_rb.html +110 -0
  77. data/rdoc/files/lib/rest-client-1_6_3/lib/restclient/resource_rb.html +101 -0
  78. data/rdoc/files/lib/rest-client-1_6_3/lib/restclient/response_rb.html +101 -0
  79. data/rdoc/files/lib/rest-client-1_6_3/lib/restclient_rb.html +111 -0
  80. data/rdoc/files/lib/restclient_fix_rb.html +115 -0
  81. data/rdoc/files/lib/smartcloud_logger_rb.html +115 -0
  82. data/rdoc/files/lib/smartcloud_rb.html +143 -0
  83. data/rdoc/files/lib/xml-simple-1_0_12/lib/xmlsimple_rb.html +124 -0
  84. data/rdoc/fr_class_index.html +79 -0
  85. data/rdoc/fr_file_index.html +48 -0
  86. data/rdoc/fr_method_index.html +441 -0
  87. data/rdoc/index.html +26 -0
  88. data/rdoc/rdoc-style.css +208 -0
  89. metadata +90 -6
@@ -0,0 +1,475 @@
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: XmlSimple</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">XmlSimple</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/xml-simple-1_0_12/lib/xmlsimple_rb.html">
59
+ lib/xml-simple-1.0.12/lib/xmlsimple.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
+ Object
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
+ Easy API to maintain XML (especially configuration files).
84
+ </p>
85
+
86
+ </div>
87
+
88
+
89
+ </div>
90
+
91
+ <div id="method-list">
92
+ <h3 class="section-bar">Methods</h3>
93
+
94
+ <div class="name-list">
95
+ <a href="#M000002">new</a>&nbsp;&nbsp;
96
+ <a href="#M000003">xml_in</a>&nbsp;&nbsp;
97
+ <a href="#M000004">xml_in</a>&nbsp;&nbsp;
98
+ <a href="#M000005">xml_out</a>&nbsp;&nbsp;
99
+ <a href="#M000006">xml_out</a>&nbsp;&nbsp;
100
+ </div>
101
+ </div>
102
+
103
+ </div>
104
+
105
+
106
+ <!-- if includes -->
107
+ <div id="includes">
108
+ <h3 class="section-bar">Included Modules</h3>
109
+
110
+ <div id="includes-list">
111
+ <span class="include-name">REXML</span>
112
+ </div>
113
+ </div>
114
+
115
+ <div id="section">
116
+
117
+ <div id="class-list">
118
+ <h3 class="section-bar">Classes and Modules</h3>
119
+
120
+ Class <a href="XmlSimple/Cache.html" class="link">XmlSimple::Cache</a><br />
121
+
122
+ </div>
123
+
124
+ <div id="constants-list">
125
+ <h3 class="section-bar">Constants</h3>
126
+
127
+ <div class="name-list">
128
+ <table summary="Constants">
129
+ <tr class="top-aligned-row context-row">
130
+ <td class="context-item-name">KNOWN_OPTIONS</td>
131
+ <td>=</td>
132
+ <td class="context-item-value">{ 'in' =&gt; %w( keyattr keeproot forcecontent contentkey noattr searchpath forcearray suppressempty anonymoustag cache grouptags normalisespace normalizespace variables varattr keytosymbol attrprefix ), 'out' =&gt; %w( keyattr keeproot contentkey noattr rootname xmldeclaration outputfile noescape suppressempty anonymoustag indent grouptags noindent attrprefix )</td>
133
+ <td width="3em">&nbsp;</td>
134
+ <td class="context-item-desc">
135
+ Declare options that are valid for <a
136
+ href="XmlSimple.html#M000003">xml_in</a> and <a
137
+ href="XmlSimple.html#M000005">xml_out</a>.
138
+
139
+ </td>
140
+ </tr>
141
+ <tr class="top-aligned-row context-row">
142
+ <td class="context-item-name">DEF_KEY_ATTRIBUTES</td>
143
+ <td>=</td>
144
+ <td class="context-item-value">[]</td>
145
+ <td width="3em">&nbsp;</td>
146
+ <td class="context-item-desc">
147
+ Define some reasonable defaults.
148
+
149
+ </td>
150
+ </tr>
151
+ <tr class="top-aligned-row context-row">
152
+ <td class="context-item-name">DEF_ROOT_NAME</td>
153
+ <td>=</td>
154
+ <td class="context-item-value">'opt'</td>
155
+ </tr>
156
+ <tr class="top-aligned-row context-row">
157
+ <td class="context-item-name">DEF_CONTENT_KEY</td>
158
+ <td>=</td>
159
+ <td class="context-item-value">'content'</td>
160
+ </tr>
161
+ <tr class="top-aligned-row context-row">
162
+ <td class="context-item-name">DEF_XML_DECLARATION</td>
163
+ <td>=</td>
164
+ <td class="context-item-value">&quot;&lt;?xml version='1.0' standalone='yes'?&gt;&quot;</td>
165
+ </tr>
166
+ <tr class="top-aligned-row context-row">
167
+ <td class="context-item-name">DEF_ANONYMOUS_TAG</td>
168
+ <td>=</td>
169
+ <td class="context-item-value">'anon'</td>
170
+ </tr>
171
+ <tr class="top-aligned-row context-row">
172
+ <td class="context-item-name">DEF_FORCE_ARRAY</td>
173
+ <td>=</td>
174
+ <td class="context-item-value">true</td>
175
+ </tr>
176
+ <tr class="top-aligned-row context-row">
177
+ <td class="context-item-name">DEF_INDENTATION</td>
178
+ <td>=</td>
179
+ <td class="context-item-value">' '</td>
180
+ </tr>
181
+ <tr class="top-aligned-row context-row">
182
+ <td class="context-item-name">DEF_KEY_TO_SYMBOL</td>
183
+ <td>=</td>
184
+ <td class="context-item-value">false</td>
185
+ </tr>
186
+ </table>
187
+ </div>
188
+ </div>
189
+
190
+
191
+
192
+
193
+
194
+
195
+ <!-- if method_list -->
196
+ <div id="methods">
197
+ <h3 class="section-bar">Public Class methods</h3>
198
+
199
+ <div id="method-M000002" class="method-detail">
200
+ <a name="M000002"></a>
201
+
202
+ <div class="method-heading">
203
+ <a href="#M000002" class="method-signature">
204
+ <span class="method-name">new</span><span class="method-args">(defaults = nil)</span>
205
+ </a>
206
+ </div>
207
+
208
+ <div class="method-description">
209
+ <p>
210
+ Creates and intializes a <a href="XmlSimple.html#M000002">new</a> <a
211
+ href="XmlSimple.html">XmlSimple</a> object.
212
+ </p>
213
+ <table>
214
+ <tr><td valign="top">defaults:</td><td>Default values for options.
215
+
216
+ </td></tr>
217
+ </table>
218
+ <p><a class="source-toggle" href="#"
219
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
220
+ <div class="method-source-code" id="M000002-source">
221
+ <pre>
222
+ <span class="ruby-comment cmt"># File lib/xml-simple-1.0.12/lib/xmlsimple.rb, line 128</span>
223
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">defaults</span> = <span class="ruby-keyword kw">nil</span>)
224
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">Hash</span>)
225
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;Options have to be a Hash.&quot;</span>
226
+ <span class="ruby-keyword kw">end</span>
227
+ <span class="ruby-ivar">@default_options</span> = <span class="ruby-identifier">normalize_option_names</span>(<span class="ruby-identifier">defaults</span>, (<span class="ruby-constant">KNOWN_OPTIONS</span>[<span class="ruby-value str">'in'</span>] <span class="ruby-operator">+</span> <span class="ruby-constant">KNOWN_OPTIONS</span>[<span class="ruby-value str">'out'</span>]).<span class="ruby-identifier">uniq</span>)
228
+ <span class="ruby-ivar">@options</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
229
+ <span class="ruby-ivar">@_var_values</span> = <span class="ruby-keyword kw">nil</span>
230
+ <span class="ruby-keyword kw">end</span>
231
+ </pre>
232
+ </div>
233
+ </div>
234
+ </div>
235
+
236
+ <div id="method-M000004" class="method-detail">
237
+ <a name="M000004"></a>
238
+
239
+ <div class="method-heading">
240
+ <a href="#M000004" class="method-signature">
241
+ <span class="method-name">xml_in</span><span class="method-args">(string = nil, options = nil)</span>
242
+ </a>
243
+ </div>
244
+
245
+ <div class="method-description">
246
+ <p>
247
+ This is the functional version of the instance method <a
248
+ href="XmlSimple.html#M000003">xml_in</a>.
249
+ </p>
250
+ <p><a class="source-toggle" href="#"
251
+ onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
252
+ <div class="method-source-code" id="M000004-source">
253
+ <pre>
254
+ <span class="ruby-comment cmt"># File lib/xml-simple-1.0.12/lib/xmlsimple.rb, line 201</span>
255
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">XmlSimple</span>.<span class="ruby-identifier">xml_in</span>(<span class="ruby-identifier">string</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
256
+ <span class="ruby-identifier">xml_simple</span> = <span class="ruby-constant">XmlSimple</span>.<span class="ruby-identifier">new</span>
257
+ <span class="ruby-identifier">xml_simple</span>.<span class="ruby-identifier">xml_in</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">options</span>)
258
+ <span class="ruby-keyword kw">end</span>
259
+ </pre>
260
+ </div>
261
+ </div>
262
+ </div>
263
+
264
+ <div id="method-M000006" class="method-detail">
265
+ <a name="M000006"></a>
266
+
267
+ <div class="method-heading">
268
+ <a href="#M000006" class="method-signature">
269
+ <span class="method-name">xml_out</span><span class="method-args">(hash, options = nil)</span>
270
+ </a>
271
+ </div>
272
+
273
+ <div class="method-description">
274
+ <p>
275
+ This is the functional version of the instance method <a
276
+ href="XmlSimple.html#M000005">xml_out</a>.
277
+ </p>
278
+ <p><a class="source-toggle" href="#"
279
+ onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
280
+ <div class="method-source-code" id="M000006-source">
281
+ <pre>
282
+ <span class="ruby-comment cmt"># File lib/xml-simple-1.0.12/lib/xmlsimple.rb, line 257</span>
283
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">XmlSimple</span>.<span class="ruby-identifier">xml_out</span>(<span class="ruby-identifier">hash</span>, <span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
284
+ <span class="ruby-identifier">xml_simple</span> = <span class="ruby-constant">XmlSimple</span>.<span class="ruby-identifier">new</span>
285
+ <span class="ruby-identifier">xml_simple</span>.<span class="ruby-identifier">xml_out</span>(<span class="ruby-identifier">hash</span>, <span class="ruby-identifier">options</span>)
286
+ <span class="ruby-keyword kw">end</span>
287
+ </pre>
288
+ </div>
289
+ </div>
290
+ </div>
291
+
292
+ <h3 class="section-bar">Public Instance methods</h3>
293
+
294
+ <div id="method-M000003" class="method-detail">
295
+ <a name="M000003"></a>
296
+
297
+ <div class="method-heading">
298
+ <a href="#M000003" class="method-signature">
299
+ <span class="method-name">xml_in</span><span class="method-args">(string = nil, options = nil)</span>
300
+ </a>
301
+ </div>
302
+
303
+ <div class="method-description">
304
+ <p>
305
+ Converts an XML document in the same way as the Perl module XML::Simple.
306
+ </p>
307
+ <table>
308
+ <tr><td valign="top">string:</td><td>XML source. Could be one of the following:
309
+
310
+ <ul>
311
+ <li>nil: Tries to load and parse &#8217;&lt;scriptname&gt;.xml&#8217;.
312
+
313
+ </li>
314
+ <li>filename: Tries to load and parse filename.
315
+
316
+ </li>
317
+ <li>IO object: Reads from object until EOF is detected and parses result.
318
+
319
+ </li>
320
+ <li>XML string: Parses string.
321
+
322
+ </li>
323
+ </ul>
324
+ </td></tr>
325
+ <tr><td valign="top">options:</td><td>Options to be used.
326
+
327
+ </td></tr>
328
+ </table>
329
+ <p><a class="source-toggle" href="#"
330
+ onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
331
+ <div class="method-source-code" id="M000003-source">
332
+ <pre>
333
+ <span class="ruby-comment cmt"># File lib/xml-simple-1.0.12/lib/xmlsimple.rb, line 149</span>
334
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xml_in</span>(<span class="ruby-identifier">string</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
335
+ <span class="ruby-identifier">handle_options</span>(<span class="ruby-value str">'in'</span>, <span class="ruby-identifier">options</span>)
336
+
337
+ <span class="ruby-comment cmt"># If no XML string or filename was supplied look for scriptname.xml.</span>
338
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">nil?</span>
339
+ <span class="ruby-identifier">string</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">basename</span>(<span class="ruby-identifier">$0</span>).<span class="ruby-identifier">dup</span>
340
+ <span class="ruby-identifier">string</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/\.[^.]+$/</span>, <span class="ruby-value str">''</span>)
341
+ <span class="ruby-identifier">string</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">'.xml'</span>
342
+
343
+ <span class="ruby-identifier">directory</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">$0</span>)
344
+ <span class="ruby-ivar">@options</span>[<span class="ruby-value str">'searchpath'</span>].<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">directory</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">directory</span>.<span class="ruby-identifier">nil?</span>
345
+ <span class="ruby-keyword kw">end</span>
346
+
347
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">String</span>)
348
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/&lt;.*?&gt;/</span><span class="ruby-identifier">m</span>
349
+ <span class="ruby-ivar">@doc</span> = <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">string</span>)
350
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">string</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'-'</span>
351
+ <span class="ruby-ivar">@doc</span> = <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">$stdin</span>.<span class="ruby-identifier">read</span>)
352
+ <span class="ruby-keyword kw">else</span>
353
+ <span class="ruby-identifier">filename</span> = <span class="ruby-identifier">find_xml_file</span>(<span class="ruby-identifier">string</span>, <span class="ruby-ivar">@options</span>[<span class="ruby-value str">'searchpath'</span>])
354
+
355
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value str">'cache'</span>)
356
+ <span class="ruby-ivar">@options</span>[<span class="ruby-value str">'cache'</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">scheme</span><span class="ruby-operator">|</span>
357
+ <span class="ruby-keyword kw">case</span>(<span class="ruby-identifier">scheme</span>)
358
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'storable'</span>
359
+ <span class="ruby-identifier">content</span> = <span class="ruby-ivar">@@cache</span>.<span class="ruby-identifier">restore_storable</span>(<span class="ruby-identifier">filename</span>)
360
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'mem_share'</span>
361
+ <span class="ruby-identifier">content</span> = <span class="ruby-ivar">@@cache</span>.<span class="ruby-identifier">restore_mem_share</span>(<span class="ruby-identifier">filename</span>)
362
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'mem_copy'</span>
363
+ <span class="ruby-identifier">content</span> = <span class="ruby-ivar">@@cache</span>.<span class="ruby-identifier">restore_mem_copy</span>(<span class="ruby-identifier">filename</span>)
364
+ <span class="ruby-keyword kw">else</span>
365
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Unsupported caching scheme: &lt;#{scheme}&gt;.&quot;</span>
366
+ <span class="ruby-keyword kw">end</span>
367
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">content</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">content</span>
368
+ }
369
+ <span class="ruby-keyword kw">end</span>
370
+
371
+ <span class="ruby-ivar">@doc</span> = <span class="ruby-identifier">load_xml_file</span>(<span class="ruby-identifier">filename</span>)
372
+ <span class="ruby-keyword kw">end</span>
373
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">IO</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">StringIO</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Zlib</span><span class="ruby-operator">::</span><span class="ruby-constant">GzipReader</span>)
374
+ <span class="ruby-ivar">@doc</span> = <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">string</span>.<span class="ruby-identifier">read</span>)
375
+ <span class="ruby-keyword kw">else</span>
376
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Could not parse object of type: &lt;#{string.type}&gt;.&quot;</span>
377
+ <span class="ruby-keyword kw">end</span>
378
+
379
+ <span class="ruby-identifier">result</span> = <span class="ruby-identifier">collapse</span>(<span class="ruby-ivar">@doc</span>.<span class="ruby-identifier">root</span>)
380
+ <span class="ruby-identifier">result</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-value str">'keeproot'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">merge</span>({}, <span class="ruby-ivar">@doc</span>.<span class="ruby-identifier">root</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">result</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">result</span>
381
+ <span class="ruby-identifier">put_into_cache</span>(<span class="ruby-identifier">result</span>, <span class="ruby-identifier">filename</span>)
382
+ <span class="ruby-identifier">result</span>
383
+ <span class="ruby-keyword kw">end</span>
384
+ </pre>
385
+ </div>
386
+ </div>
387
+ </div>
388
+
389
+ <div id="method-M000005" class="method-detail">
390
+ <a name="M000005"></a>
391
+
392
+ <div class="method-heading">
393
+ <a href="#M000005" class="method-signature">
394
+ <span class="method-name">xml_out</span><span class="method-args">(ref, options = nil)</span>
395
+ </a>
396
+ </div>
397
+
398
+ <div class="method-description">
399
+ <p>
400
+ Converts a data structure into an XML document.
401
+ </p>
402
+ <table>
403
+ <tr><td valign="top">ref:</td><td>Reference to data structure to be converted into XML.
404
+
405
+ </td></tr>
406
+ <tr><td valign="top">options:</td><td>Options to be used.
407
+
408
+ </td></tr>
409
+ </table>
410
+ <p><a class="source-toggle" href="#"
411
+ onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
412
+ <div class="method-source-code" id="M000005-source">
413
+ <pre>
414
+ <span class="ruby-comment cmt"># File lib/xml-simple-1.0.12/lib/xmlsimple.rb, line 212</span>
415
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xml_out</span>(<span class="ruby-identifier">ref</span>, <span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
416
+ <span class="ruby-identifier">handle_options</span>(<span class="ruby-value str">'out'</span>, <span class="ruby-identifier">options</span>)
417
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ref</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">Array</span>)
418
+ <span class="ruby-identifier">ref</span> = { <span class="ruby-ivar">@options</span>[<span class="ruby-value str">'anonymoustag'</span>] =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ref</span> }
419
+ <span class="ruby-keyword kw">end</span>
420
+
421
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value str">'keeproot'</span>]
422
+ <span class="ruby-identifier">keys</span> = <span class="ruby-identifier">ref</span>.<span class="ruby-identifier">keys</span>
423
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
424
+ <span class="ruby-identifier">ref</span> = <span class="ruby-identifier">ref</span>[<span class="ruby-identifier">keys</span>[<span class="ruby-value">0</span>]]
425
+ <span class="ruby-ivar">@options</span>[<span class="ruby-value str">'rootname'</span>] = <span class="ruby-identifier">keys</span>[<span class="ruby-value">0</span>]
426
+ <span class="ruby-keyword kw">end</span>
427
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value str">'rootname'</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">''</span>
428
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ref</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">Hash</span>)
429
+ <span class="ruby-identifier">refsave</span> = <span class="ruby-identifier">ref</span>
430
+ <span class="ruby-identifier">ref</span> = {}
431
+ <span class="ruby-identifier">refsave</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
432
+ <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">scalar</span>(<span class="ruby-identifier">value</span>)
433
+ <span class="ruby-identifier">ref</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>
434
+ <span class="ruby-keyword kw">else</span>
435
+ <span class="ruby-identifier">ref</span>[<span class="ruby-identifier">key</span>] = [ <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span> ]
436
+ <span class="ruby-keyword kw">end</span>
437
+ }
438
+ <span class="ruby-keyword kw">end</span>
439
+ <span class="ruby-keyword kw">end</span>
440
+
441
+ <span class="ruby-ivar">@ancestors</span> = []
442
+ <span class="ruby-identifier">xml</span> = <span class="ruby-identifier">value_to_xml</span>(<span class="ruby-identifier">ref</span>, <span class="ruby-ivar">@options</span>[<span class="ruby-value str">'rootname'</span>], <span class="ruby-value str">''</span>)
443
+ <span class="ruby-ivar">@ancestors</span> = <span class="ruby-keyword kw">nil</span>
444
+
445
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value str">'xmldeclaration'</span>]
446
+ <span class="ruby-identifier">xml</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-value str">'xmldeclaration'</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">xml</span>
447
+ <span class="ruby-keyword kw">end</span>
448
+
449
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value str">'outputfile'</span>)
450
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value str">'outputfile'</span>].<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">IO</span>)
451
+ <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value str">'outputfile'</span>].<span class="ruby-identifier">write</span>(<span class="ruby-identifier">xml</span>)
452
+ <span class="ruby-keyword kw">else</span>
453
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-ivar">@options</span>[<span class="ruby-value str">'outputfile'</span>], <span class="ruby-value str">&quot;w&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">xml</span>) }
454
+ <span class="ruby-keyword kw">end</span>
455
+ <span class="ruby-keyword kw">end</span>
456
+ <span class="ruby-identifier">xml</span>
457
+ <span class="ruby-keyword kw">end</span>
458
+ </pre>
459
+ </div>
460
+ </div>
461
+ </div>
462
+
463
+
464
+ </div>
465
+
466
+
467
+ </div>
468
+
469
+
470
+ <div id="validator-badges">
471
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
472
+ </div>
473
+
474
+ </body>
475
+ </html>
data/rdoc/created.rid ADDED
@@ -0,0 +1 @@
1
+ Tue, 26 Jul 2011 09:16:41 -0700