cft_smartcloud 0.1.4 → 0.1.5

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 (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,643 @@
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: MIME::Types</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">MIME::Types</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/mime-types-1_16/lib/mime/types_rb.html">
59
+ lib/mime-types-1.16/lib/mime/types.rb
60
+ </a>
61
+ <br />
62
+ <a href="../../files/lib/rest-client-1_6_3/lib/restclient/request_rb.html">
63
+ lib/rest-client-1.6.3/lib/restclient/request.rb
64
+ </a>
65
+ <br />
66
+ </td>
67
+ </tr>
68
+
69
+ <tr class="top-aligned-row">
70
+ <td><strong>Parent:</strong></td>
71
+ <td>
72
+ Object
73
+ </td>
74
+ </tr>
75
+ </table>
76
+ </div>
77
+ <!-- banner header -->
78
+
79
+ <div id="bodyContent">
80
+
81
+
82
+
83
+ <div id="contextContent">
84
+
85
+ <div id="description">
86
+ <h1><a href="Types.html">MIME::Types</a></h1>
87
+ <p>
88
+ <a href="../MIME.html">MIME</a> types are used in <a
89
+ href="../MIME.html">MIME</a>-compliant communications, as in e-mail or HTTP
90
+ traffic, to indicate the type <a href="Types.html#M000367">of</a> content
91
+ which is transmitted. <a href="Types.html">MIME::Types</a> provides the
92
+ ability for detailed information about <a href="../MIME.html">MIME</a>
93
+ entities (provided as a set <a href="Types.html#M000367">of</a> <a
94
+ href="Type.html">MIME::Type</a> objects) to be determined and used
95
+ programmatically. There are many types defined by RFCs and vendors, so the
96
+ list is long but not complete; don&#8216;t hesitate to ask to <a
97
+ href="Types.html#M000368">add</a> additional information. This library
98
+ follows the IANA collection <a href="Types.html#M000367">of</a> <a
99
+ href="../MIME.html">MIME</a> types (see below for reference).
100
+ </p>
101
+ <h2>Description</h2>
102
+ <p>
103
+ <a href="../MIME.html">MIME</a> types are used in <a
104
+ href="../MIME.html">MIME</a> entities, as in email or HTTP traffic. It is
105
+ useful at times to have information available about <a
106
+ href="../MIME.html">MIME</a> types (or, inversely, about files). A <a
107
+ href="Type.html">MIME::Type</a> stores the known information about one <a
108
+ href="../MIME.html">MIME</a> type.
109
+ </p>
110
+ <h2>Usage</h2>
111
+ <pre>
112
+ require 'mime/types'
113
+
114
+ plaintext = MIME::Types['text/plain']
115
+ print plaintext.media_type # =&gt; 'text'
116
+ print plaintext.sub_type # =&gt; 'plain'
117
+
118
+ puts plaintext.extensions.join(&quot; &quot;) # =&gt; 'asc txt c cc h hh cpp'
119
+
120
+ puts plaintext.encoding # =&gt; 8bit
121
+ puts plaintext.binary? # =&gt; false
122
+ puts plaintext.ascii? # =&gt; true
123
+ puts plaintext.obsolete? # =&gt; false
124
+ puts plaintext.registered? # =&gt; true
125
+ puts plaintext == 'text/plain' # =&gt; true
126
+ puts MIME::Type.simplified('x-appl/x-zip') # =&gt; 'appl/zip'
127
+ </pre>
128
+ <p>
129
+ This module is built to conform to the <a href="../MIME.html">MIME</a>
130
+ types <a href="Types.html#M000367">of</a> RFCs 2045 and 2231. It follows
131
+ the official IANA registry at <a
132
+ href="http://www.iana.org/assignments/media-types">www.iana.org/assignments/media-types</a>/
133
+ and <a
134
+ href="ftp://ftp.iana.org/assignments/media-types">ftp.iana.org/assignments/media-types</a>
135
+ with some unofficial types added from the the collection at <a
136
+ href="http://www.ltsw.se/knbase/internet/mime.htp">www.ltsw.se/knbase/internet/mime.htp</a>
137
+ </p>
138
+ <p>
139
+ This is originally based on Perl <a href="Types.html">MIME::Types</a> by
140
+ Mark Overmeer.
141
+ </p>
142
+ <h1>Author</h1>
143
+ <table>
144
+ <tr><td valign="top">Copyright:</td><td>Copyright (c) 2002 - 2009 by Austin Ziegler &lt;austin@rubyforge.org&gt;
145
+
146
+ </td></tr>
147
+ <tr><td valign="top">Version:</td><td>1.16
148
+
149
+ </td></tr>
150
+ <tr><td valign="top">Based On:</td><td>Perl <a
151
+ href="http://search.cpan.org/author/MARKOV/MIME-Types-1.27/MIME/Types.pm">MIME::Types</a>,
152
+ Copyright (c) 2001 - 2009 by Mark Overmeer &lt;mimetypes@overmeer.net&gt;.
153
+
154
+ </td></tr>
155
+ <tr><td valign="top">Licence:</td><td>Ruby&#8216;s, Perl Artistic, or GPL version 2 (or later)
156
+
157
+ </td></tr>
158
+ <tr><td valign="top">See Also:</td><td><a
159
+ href="http://www.iana.org/assignments/media-types">www.iana.org/assignments/media-types</a>/
160
+ <a
161
+ href="http://www.ltsw.se/knbase/internet/mime.htp">www.ltsw.se/knbase/internet/mime.htp</a>
162
+
163
+ </td></tr>
164
+ </table>
165
+
166
+ </div>
167
+
168
+
169
+ </div>
170
+
171
+ <div id="method-list">
172
+ <h3 class="section-bar">Methods</h3>
173
+
174
+ <div class="name-list">
175
+ <a href="#M000369">[]</a>&nbsp;&nbsp;
176
+ <a href="#M000365">[]</a>&nbsp;&nbsp;
177
+ <a href="#M000372">add</a>&nbsp;&nbsp;
178
+ <a href="#M000368">add</a>&nbsp;&nbsp;
179
+ <a href="#M000364">new</a>&nbsp;&nbsp;
180
+ <a href="#M000367">of</a>&nbsp;&nbsp;
181
+ <a href="#M000371">of</a>&nbsp;&nbsp;
182
+ <a href="#M000370">type_for</a>&nbsp;&nbsp;
183
+ <a href="#M000366">type_for</a>&nbsp;&nbsp;
184
+ <a href="#M000373">type_for_extension</a>&nbsp;&nbsp;
185
+ <a href="#M000374">type_for_extension</a>&nbsp;&nbsp;
186
+ </div>
187
+ </div>
188
+
189
+ </div>
190
+
191
+
192
+ <!-- if includes -->
193
+
194
+ <div id="section">
195
+
196
+
197
+ <div id="constants-list">
198
+ <h3 class="section-bar">Constants</h3>
199
+
200
+ <div class="name-list">
201
+ <table summary="Constants">
202
+ <tr class="top-aligned-row context-row">
203
+ <td class="context-item-name">VERSION</td>
204
+ <td>=</td>
205
+ <td class="context-item-value">'1.16'</td>
206
+ <td width="3em">&nbsp;</td>
207
+ <td class="context-item-desc">
208
+ The released version <a href="Types.html#M000367">of</a> Ruby <a
209
+ href="Types.html">MIME::Types</a>
210
+
211
+ </td>
212
+ </tr>
213
+ </table>
214
+ </div>
215
+ </div>
216
+
217
+
218
+
219
+ <div id="attribute-list">
220
+ <h3 class="section-bar">Attributes</h3>
221
+
222
+ <div class="name-list">
223
+ <table>
224
+ <tr class="top-aligned-row context-row">
225
+ <td class="context-item-name">data_version</td>
226
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
227
+ <td class="context-item-desc">
228
+ The data version.
229
+
230
+ </td>
231
+ </tr>
232
+ </table>
233
+ </div>
234
+ </div>
235
+
236
+
237
+
238
+ <!-- if method_list -->
239
+ <div id="methods">
240
+ <h3 class="section-bar">Public Class methods</h3>
241
+
242
+ <div id="method-M000369" class="method-detail">
243
+ <a name="M000369"></a>
244
+
245
+ <div class="method-heading">
246
+ <a href="#M000369" class="method-signature">
247
+ <span class="method-name">[]</span><span class="method-args">(type_id, flags = {})</span>
248
+ </a>
249
+ </div>
250
+
251
+ <div class="method-description">
252
+ <p>
253
+ Returns a list <a href="Types.html#M000367">of</a> <a
254
+ href="Type.html">MIME::Type</a> objects, which may be empty. The optional
255
+ flag parameters are :complete (finds only complete <a
256
+ href="Type.html">MIME::Type</a> objects) and :platform (finds only <a
257
+ href="Types.html">MIME::Types</a> for the current platform). It is possible
258
+ for multiple matches to be returned for either type (in the example below,
259
+ &#8216;text/plain&#8217; returns two values &#8212; one for the general
260
+ case, and one for VMS systems.
261
+ </p>
262
+ <pre>
263
+ puts &quot;\nMIME::Types['text/plain']&quot;
264
+ MIME::Types['text/plain'].each { |t| puts t.to_a.join(&quot;, &quot;) }
265
+
266
+ puts &quot;\nMIME::Types[/^image/, :complete =&gt; true]&quot;
267
+ MIME::Types[/^image/, :complete =&gt; true].each do |t|
268
+ puts t.to_a.join(&quot;, &quot;)
269
+ end
270
+ </pre>
271
+ <p><a class="source-toggle" href="#"
272
+ onclick="toggleCode('M000369-source');return false;">[Source]</a></p>
273
+ <div class="method-source-code" id="M000369-source">
274
+ <pre>
275
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 717</span>
276
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">type_id</span>, <span class="ruby-identifier">flags</span> = {})
277
+ <span class="ruby-ivar">@__types__</span>[<span class="ruby-identifier">type_id</span>, <span class="ruby-identifier">flags</span>]
278
+ <span class="ruby-keyword kw">end</span>
279
+ </pre>
280
+ </div>
281
+ </div>
282
+ </div>
283
+
284
+ <div id="method-M000372" class="method-detail">
285
+ <a name="M000372"></a>
286
+
287
+ <div class="method-heading">
288
+ <a href="#M000372" class="method-signature">
289
+ <span class="method-name">add</span><span class="method-args">(*types)</span>
290
+ </a>
291
+ </div>
292
+
293
+ <div class="method-description">
294
+ <p>
295
+ Add one or more <a href="Type.html">MIME::Type</a> objects to the set <a
296
+ href="Types.html#M000367">of</a> known types. Each type should be
297
+ experimental (e.g., &#8216;application/x-ruby&#8217;). If the type is
298
+ already known, a warning will be displayed.
299
+ </p>
300
+ <p>
301
+ <b>Please inform the maintainer <a href="Types.html#M000367">of</a> this
302
+ module when registered types are missing.</b>
303
+ </p>
304
+ <p><a class="source-toggle" href="#"
305
+ onclick="toggleCode('M000372-source');return false;">[Source]</a></p>
306
+ <div class="method-source-code" id="M000372-source">
307
+ <pre>
308
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 744</span>
309
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">types</span>)
310
+ <span class="ruby-ivar">@__types__</span>.<span class="ruby-identifier">add</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">types</span>)
311
+ <span class="ruby-keyword kw">end</span>
312
+ </pre>
313
+ </div>
314
+ </div>
315
+ </div>
316
+
317
+ <div id="method-M000364" class="method-detail">
318
+ <a name="M000364"></a>
319
+
320
+ <div class="method-heading">
321
+ <a href="#M000364" class="method-signature">
322
+ <span class="method-name">new</span><span class="method-args">(data_version = nil)</span>
323
+ </a>
324
+ </div>
325
+
326
+ <div class="method-description">
327
+ <p><a class="source-toggle" href="#"
328
+ onclick="toggleCode('M000364-source');return false;">[Source]</a></p>
329
+ <div class="method-source-code" id="M000364-source">
330
+ <pre>
331
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 596</span>
332
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">data_version</span> = <span class="ruby-keyword kw">nil</span>)
333
+ <span class="ruby-ivar">@type_variants</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">h</span>, <span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = [] }
334
+ <span class="ruby-ivar">@extension_index</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">h</span>, <span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = [] }
335
+ <span class="ruby-keyword kw">end</span>
336
+ </pre>
337
+ </div>
338
+ </div>
339
+ </div>
340
+
341
+ <div id="method-M000371" class="method-detail">
342
+ <a name="M000371"></a>
343
+
344
+ <div class="method-heading">
345
+ <a href="#M000371" class="method-signature">
346
+ <span class="method-name">of</span><span class="method-args">(filename, platform = false)</span>
347
+ </a>
348
+ </div>
349
+
350
+ <div class="method-description">
351
+ <p>
352
+ A synonym for <a href="Types.html#M000366">MIME::Types.type_for</a>
353
+ </p>
354
+ <p><a class="source-toggle" href="#"
355
+ onclick="toggleCode('M000371-source');return false;">[Source]</a></p>
356
+ <div class="method-source-code" id="M000371-source">
357
+ <pre>
358
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 734</span>
359
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">of</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">platform</span> = <span class="ruby-keyword kw">false</span>)
360
+ <span class="ruby-ivar">@__types__</span>.<span class="ruby-identifier">type_for</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">platform</span>)
361
+ <span class="ruby-keyword kw">end</span>
362
+ </pre>
363
+ </div>
364
+ </div>
365
+ </div>
366
+
367
+ <div id="method-M000370" class="method-detail">
368
+ <a name="M000370"></a>
369
+
370
+ <div class="method-heading">
371
+ <a href="#M000370" class="method-signature">
372
+ <span class="method-name">type_for</span><span class="method-args">(filename, platform = false)</span>
373
+ </a>
374
+ </div>
375
+
376
+ <div class="method-description">
377
+ <p>
378
+ Return the list <a href="Types.html#M000367">of</a> <a
379
+ href="Types.html">MIME::Types</a> which belongs to the file based on its
380
+ filename extension. If <tt>platform</tt> is <tt>true</tt>, then only file
381
+ types that are specific to the current platform will be returned.
382
+ </p>
383
+ <pre>
384
+ puts &quot;MIME::Types.type_for('citydesk.xml')
385
+ =&gt; &quot;#{MIME::Types.type_for('citydesk.xml')}&quot;
386
+ puts &quot;MIME::Types.type_for('citydesk.gif')
387
+ =&gt; &quot;#{MIME::Types.type_for('citydesk.gif')}&quot;
388
+ </pre>
389
+ <p><a class="source-toggle" href="#"
390
+ onclick="toggleCode('M000370-source');return false;">[Source]</a></p>
391
+ <div class="method-source-code" id="M000370-source">
392
+ <pre>
393
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 729</span>
394
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type_for</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">platform</span> = <span class="ruby-keyword kw">false</span>)
395
+ <span class="ruby-ivar">@__types__</span>.<span class="ruby-identifier">type_for</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">platform</span>)
396
+ <span class="ruby-keyword kw">end</span>
397
+ </pre>
398
+ </div>
399
+ </div>
400
+ </div>
401
+
402
+ <div id="method-M000374" class="method-detail">
403
+ <a name="M000374"></a>
404
+
405
+ <div class="method-heading">
406
+ <a href="#M000374" class="method-signature">
407
+ <span class="method-name">type_for_extension</span><span class="method-args">(ext)</span>
408
+ </a>
409
+ </div>
410
+
411
+ <div class="method-description">
412
+ <p><a class="source-toggle" href="#"
413
+ onclick="toggleCode('M000374-source');return false;">[Source]</a></p>
414
+ <div class="method-source-code" id="M000374-source">
415
+ <pre>
416
+ <span class="ruby-comment cmt"># File lib/rest-client-1.6.3/lib/restclient/request.rb, line 309</span>
417
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type_for_extension</span> <span class="ruby-identifier">ext</span>
418
+ <span class="ruby-ivar">@__types__</span>.<span class="ruby-identifier">type_for_extension</span> <span class="ruby-identifier">ext</span>
419
+ <span class="ruby-keyword kw">end</span>
420
+ </pre>
421
+ </div>
422
+ </div>
423
+ </div>
424
+
425
+ <h3 class="section-bar">Public Instance methods</h3>
426
+
427
+ <div id="method-M000365" class="method-detail">
428
+ <a name="M000365"></a>
429
+
430
+ <div class="method-heading">
431
+ <a href="#M000365" class="method-signature">
432
+ <span class="method-name">[]</span><span class="method-args">(type_id, flags = {})</span>
433
+ </a>
434
+ </div>
435
+
436
+ <div class="method-description">
437
+ <p>
438
+ Returns a list <a href="Types.html#M000367">of</a> <a
439
+ href="Type.html">MIME::Type</a> objects, which may be empty. The optional
440
+ flag parameters are :complete (finds only complete <a
441
+ href="Type.html">MIME::Type</a> objects) and :platform (finds only <a
442
+ href="Types.html">MIME::Types</a> for the current platform). It is possible
443
+ for multiple matches to be returned for either type (in the example below,
444
+ &#8216;text/plain&#8217; returns two values &#8212; one for the general
445
+ case, and one for VMS systems.
446
+ </p>
447
+ <pre>
448
+ puts &quot;\nMIME::Types['text/plain']&quot;
449
+ MIME::Types['text/plain'].each { |t| puts t.to_a.join(&quot;, &quot;) }
450
+
451
+ puts &quot;\nMIME::Types[/^image/, :complete =&gt; true]&quot;
452
+ MIME::Types[/^image/, :complete =&gt; true].each do |t|
453
+ puts t.to_a.join(&quot;, &quot;)
454
+ end
455
+ </pre>
456
+ <p>
457
+ If multiple type definitions are returned, returns them sorted as follows:
458
+ </p>
459
+ <pre>
460
+ 1. Complete definitions sort before incomplete ones;
461
+ 2. IANA-registered definitions sort before LTSW-recorded
462
+ definitions.
463
+ 3. Generic definitions sort before platform-specific ones;
464
+ 4. Current definitions sort before obsolete ones;
465
+ 5. Obsolete definitions with use-instead clauses sort before those
466
+ without;
467
+ 6. Obsolete definitions use-instead clauses are compared.
468
+ 7. Sort on name.
469
+ </pre>
470
+ <p><a class="source-toggle" href="#"
471
+ onclick="toggleCode('M000365-source');return false;">[Source]</a></p>
472
+ <div class="method-source-code" id="M000365-source">
473
+ <pre>
474
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 637</span>
475
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">type_id</span>, <span class="ruby-identifier">flags</span> = {})
476
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">type_id</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Regexp</span>)
477
+ <span class="ruby-identifier">matches</span> = []
478
+ <span class="ruby-ivar">@type_variants</span>.<span class="ruby-identifier">each_key</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
479
+ <span class="ruby-identifier">matches</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@type_variants</span>[<span class="ruby-identifier">k</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">type_id</span>
480
+ <span class="ruby-keyword kw">end</span>
481
+ <span class="ruby-identifier">matches</span>.<span class="ruby-identifier">flatten!</span>
482
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">type_id</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">MIME</span><span class="ruby-operator">::</span><span class="ruby-constant">Type</span>)
483
+ <span class="ruby-identifier">matches</span> = [<span class="ruby-identifier">type_id</span>]
484
+ <span class="ruby-keyword kw">else</span>
485
+ <span class="ruby-identifier">matches</span> = <span class="ruby-ivar">@type_variants</span>[<span class="ruby-constant">MIME</span><span class="ruby-operator">::</span><span class="ruby-constant">Type</span>.<span class="ruby-identifier">simplified</span>(<span class="ruby-identifier">type_id</span>)]
486
+ <span class="ruby-keyword kw">end</span>
487
+
488
+ <span class="ruby-identifier">matches</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">complete?</span> } <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">flags</span>[<span class="ruby-identifier">:complete</span>]
489
+ <span class="ruby-identifier">matches</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">platform?</span> } <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">flags</span>[<span class="ruby-identifier">:platform</span>]
490
+
491
+ <span class="ruby-identifier">matches</span>.<span class="ruby-identifier">sort</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">priority_compare</span>(<span class="ruby-identifier">b</span>) }
492
+ <span class="ruby-keyword kw">end</span>
493
+ </pre>
494
+ </div>
495
+ </div>
496
+ </div>
497
+
498
+ <div id="method-M000368" class="method-detail">
499
+ <a name="M000368"></a>
500
+
501
+ <div class="method-heading">
502
+ <a href="#M000368" class="method-signature">
503
+ <span class="method-name">add</span><span class="method-args">(*types)</span>
504
+ </a>
505
+ </div>
506
+
507
+ <div class="method-description">
508
+ <p>
509
+ Add one or more <a href="Type.html">MIME::Type</a> objects to the set <a
510
+ href="Types.html#M000367">of</a> known types. Each type should be
511
+ experimental (e.g., &#8216;application/x-ruby&#8217;). If the type is
512
+ already known, a warning will be displayed.
513
+ </p>
514
+ <p>
515
+ <b>Please inform the maintainer <a href="Types.html#M000367">of</a> this
516
+ module when registered types are missing.</b>
517
+ </p>
518
+ <p><a class="source-toggle" href="#"
519
+ onclick="toggleCode('M000368-source');return false;">[Source]</a></p>
520
+ <div class="method-source-code" id="M000368-source">
521
+ <pre>
522
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 682</span>
523
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">types</span>)
524
+ <span class="ruby-identifier">types</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mime_type</span><span class="ruby-operator">|</span>
525
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@type_variants</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">mime_type</span>.<span class="ruby-identifier">simplified</span>)
526
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@type_variants</span>[<span class="ruby-identifier">mime_type</span>.<span class="ruby-identifier">simplified</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">mime_type</span>)
527
+ <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;Type #{mime_type} already registered as a variant of #{mime_type.simplified}.&quot;</span>
528
+ <span class="ruby-keyword kw">end</span>
529
+ <span class="ruby-keyword kw">end</span>
530
+ <span class="ruby-identifier">add_type_variant</span>(<span class="ruby-identifier">mime_type</span>)
531
+ <span class="ruby-identifier">index_extensions</span>(<span class="ruby-identifier">mime_type</span>)
532
+ <span class="ruby-keyword kw">end</span>
533
+ <span class="ruby-keyword kw">end</span>
534
+ </pre>
535
+ </div>
536
+ </div>
537
+ </div>
538
+
539
+ <div id="method-M000367" class="method-detail">
540
+ <a name="M000367"></a>
541
+
542
+ <div class="method-heading">
543
+ <a href="#M000367" class="method-signature">
544
+ <span class="method-name">of</span><span class="method-args">(filename, platform = false)</span>
545
+ </a>
546
+ </div>
547
+
548
+ <div class="method-description">
549
+ <p>
550
+ A synonym for <a href="Types.html#M000366">MIME::Types.type_for</a>
551
+ </p>
552
+ <p><a class="source-toggle" href="#"
553
+ onclick="toggleCode('M000367-source');return false;">[Source]</a></p>
554
+ <div class="method-source-code" id="M000367-source">
555
+ <pre>
556
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 672</span>
557
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">of</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">platform</span> = <span class="ruby-keyword kw">false</span>)
558
+ <span class="ruby-identifier">type_for</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">platform</span>)
559
+ <span class="ruby-keyword kw">end</span>
560
+ </pre>
561
+ </div>
562
+ </div>
563
+ </div>
564
+
565
+ <div id="method-M000366" class="method-detail">
566
+ <a name="M000366"></a>
567
+
568
+ <div class="method-heading">
569
+ <a href="#M000366" class="method-signature">
570
+ <span class="method-name">type_for</span><span class="method-args">(filename, platform = false)</span>
571
+ </a>
572
+ </div>
573
+
574
+ <div class="method-description">
575
+ <p>
576
+ Return the list <a href="Types.html#M000367">of</a> <a
577
+ href="Types.html">MIME::Types</a> which belongs to the file based on its
578
+ filename extension. If <tt>platform</tt> is <tt>true</tt>, then only file
579
+ types that are specific to the current platform will be returned.
580
+ </p>
581
+ <pre>
582
+ puts &quot;MIME::Types.type_for('citydesk.xml')
583
+ =&gt; &quot;#{MIME::Types.type_for('citydesk.xml')}&quot;
584
+ puts &quot;MIME::Types.type_for('citydesk.gif')
585
+ =&gt; &quot;#{MIME::Types.type_for('citydesk.gif')}&quot;
586
+ </pre>
587
+ <p><a class="source-toggle" href="#"
588
+ onclick="toggleCode('M000366-source');return false;">[Source]</a></p>
589
+ <div class="method-source-code" id="M000366-source">
590
+ <pre>
591
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 664</span>
592
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type_for</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">platform</span> = <span class="ruby-keyword kw">false</span>)
593
+ <span class="ruby-identifier">ext</span> = <span class="ruby-identifier">filename</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/.*\./o</span>, <span class="ruby-value str">''</span>)
594
+ <span class="ruby-identifier">list</span> = <span class="ruby-ivar">@extension_index</span>[<span class="ruby-identifier">ext</span>]
595
+ <span class="ruby-identifier">list</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">platform?</span> } <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">platform</span>
596
+ <span class="ruby-identifier">list</span>
597
+ <span class="ruby-keyword kw">end</span>
598
+ </pre>
599
+ </div>
600
+ </div>
601
+ </div>
602
+
603
+ <div id="method-M000373" class="method-detail">
604
+ <a name="M000373"></a>
605
+
606
+ <div class="method-heading">
607
+ <a href="#M000373" class="method-signature">
608
+ <span class="method-name">type_for_extension</span><span class="method-args">(ext)</span>
609
+ </a>
610
+ </div>
611
+
612
+ <div class="method-description">
613
+ <p>
614
+ Return the first found content-type for a value considered as an extension
615
+ or the value itself
616
+ </p>
617
+ <p><a class="source-toggle" href="#"
618
+ onclick="toggleCode('M000373-source');return false;">[Source]</a></p>
619
+ <div class="method-source-code" id="M000373-source">
620
+ <pre>
621
+ <span class="ruby-comment cmt"># File lib/rest-client-1.6.3/lib/restclient/request.rb, line 303</span>
622
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type_for_extension</span> <span class="ruby-identifier">ext</span>
623
+ <span class="ruby-identifier">candidates</span> = <span class="ruby-ivar">@extension_index</span>[<span class="ruby-identifier">ext</span>]
624
+ <span class="ruby-identifier">candidates</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-identifier">ext</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">candidates</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">content_type</span>
625
+ <span class="ruby-keyword kw">end</span>
626
+ </pre>
627
+ </div>
628
+ </div>
629
+ </div>
630
+
631
+
632
+ </div>
633
+
634
+
635
+ </div>
636
+
637
+
638
+ <div id="validator-badges">
639
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
640
+ </div>
641
+
642
+ </body>
643
+ </html>