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,1366 @@
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::Type</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::Type</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
+ </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
+ The definition of one <a href="../MIME.html">MIME</a> content-type.
84
+ </p>
85
+ <h2>Usage</h2>
86
+ <pre>
87
+ require 'mime/types'
88
+
89
+ plaintext = MIME::Types['text/plain']
90
+ print plaintext.media_type # =&gt; 'text'
91
+ print plaintext.sub_type # =&gt; 'plain'
92
+
93
+ puts plaintext.extensions.join(&quot; &quot;) # =&gt; 'asc txt c cc h hh cpp'
94
+
95
+ puts plaintext.encoding # =&gt; 8bit
96
+ puts plaintext.binary? # =&gt; false
97
+ puts plaintext.ascii? # =&gt; true
98
+ puts plaintext == 'text/plain' # =&gt; true
99
+ puts MIME::Type.simplified('x-appl/x-zip') # =&gt; 'appl/zip'
100
+ </pre>
101
+
102
+ </div>
103
+
104
+
105
+ </div>
106
+
107
+ <div id="method-list">
108
+ <h3 class="section-bar">Methods</h3>
109
+
110
+ <div class="name-list">
111
+ <a href="#M000376">&lt;=&gt;</a>&nbsp;&nbsp;
112
+ <a href="#M000391">ascii?</a>&nbsp;&nbsp;
113
+ <a href="#M000390">binary?</a>&nbsp;&nbsp;
114
+ <a href="#M000395">complete?</a>&nbsp;&nbsp;
115
+ <a href="#M000379">default_encoding</a>&nbsp;&nbsp;
116
+ <a href="#M000382">docs=</a>&nbsp;&nbsp;
117
+ <a href="#M000378">eql?</a>&nbsp;&nbsp;
118
+ <a href="#M000385">from_array</a>&nbsp;&nbsp;
119
+ <a href="#M000386">from_hash</a>&nbsp;&nbsp;
120
+ <a href="#M000387">from_mime_type</a>&nbsp;&nbsp;
121
+ <a href="#M000375">like?</a>&nbsp;&nbsp;
122
+ <a href="#M000388">new</a>&nbsp;&nbsp;
123
+ <a href="#M000381">obsolete?</a>&nbsp;&nbsp;
124
+ <a href="#M000394">platform?</a>&nbsp;&nbsp;
125
+ <a href="#M000377">priority_compare</a>&nbsp;&nbsp;
126
+ <a href="#M000389">registered?</a>&nbsp;&nbsp;
127
+ <a href="#M000392">signature?</a>&nbsp;&nbsp;
128
+ <a href="#M000384">simplified</a>&nbsp;&nbsp;
129
+ <a href="#M000393">system?</a>&nbsp;&nbsp;
130
+ <a href="#M000398">to_a</a>&nbsp;&nbsp;
131
+ <a href="#M000399">to_hash</a>&nbsp;&nbsp;
132
+ <a href="#M000396">to_s</a>&nbsp;&nbsp;
133
+ <a href="#M000397">to_str</a>&nbsp;&nbsp;
134
+ <a href="#M000383">urls</a>&nbsp;&nbsp;
135
+ <a href="#M000380">use_instead</a>&nbsp;&nbsp;
136
+ </div>
137
+ </div>
138
+
139
+ </div>
140
+
141
+
142
+ <!-- if includes -->
143
+ <div id="includes">
144
+ <h3 class="section-bar">Included Modules</h3>
145
+
146
+ <div id="includes-list">
147
+ <span class="include-name">Comparable</span>
148
+ </div>
149
+ </div>
150
+
151
+ <div id="section">
152
+
153
+
154
+ <div id="constants-list">
155
+ <h3 class="section-bar">Constants</h3>
156
+
157
+ <div class="name-list">
158
+ <table summary="Constants">
159
+ <tr class="top-aligned-row context-row">
160
+ <td class="context-item-name">VERSION</td>
161
+ <td>=</td>
162
+ <td class="context-item-value">'1.16'</td>
163
+ </tr>
164
+ <tr class="top-aligned-row context-row">
165
+ <td class="context-item-name">MEDIA_TYPE_RE</td>
166
+ <td>=</td>
167
+ <td class="context-item-value">%r{([-\w.+]+)/([-\w.+]*)}o</td>
168
+ </tr>
169
+ <tr class="top-aligned-row context-row">
170
+ <td class="context-item-name">UNREG_RE</td>
171
+ <td>=</td>
172
+ <td class="context-item-value">%r{[Xx]-}o</td>
173
+ </tr>
174
+ <tr class="top-aligned-row context-row">
175
+ <td class="context-item-name">ENCODING_RE</td>
176
+ <td>=</td>
177
+ <td class="context-item-value">%r{(?:base64|7bit|8bit|quoted\-printable)}o</td>
178
+ </tr>
179
+ <tr class="top-aligned-row context-row">
180
+ <td class="context-item-name">PLATFORM_RE</td>
181
+ <td>=</td>
182
+ <td class="context-item-value">%r|#{RUBY_PLATFORM}|o</td>
183
+ </tr>
184
+ <tr class="top-aligned-row context-row">
185
+ <td class="context-item-name">SIGNATURES</td>
186
+ <td>=</td>
187
+ <td class="context-item-value">%w(application/pgp-keys application/pgp application/pgp-signature application/pkcs10 application/pkcs7-mime application/pkcs7-signature text/vcard)</td>
188
+ </tr>
189
+ <tr class="top-aligned-row context-row">
190
+ <td class="context-item-name">IANA_URL</td>
191
+ <td>=</td>
192
+ <td class="context-item-value">&quot;http://www.iana.org/assignments/media-types/%s/%s&quot;</td>
193
+ </tr>
194
+ <tr class="top-aligned-row context-row">
195
+ <td class="context-item-name">RFC_URL</td>
196
+ <td>=</td>
197
+ <td class="context-item-value">&quot;http://rfc-editor.org/rfc/rfc%s.txt&quot;</td>
198
+ </tr>
199
+ <tr class="top-aligned-row context-row">
200
+ <td class="context-item-name">DRAFT_URL</td>
201
+ <td>=</td>
202
+ <td class="context-item-value">&quot;http://datatracker.ietf.org/public/idindex.cgi?command=id_details&amp;filename=%s&quot;</td>
203
+ </tr>
204
+ <tr class="top-aligned-row context-row">
205
+ <td class="context-item-name">LTSW_URL</td>
206
+ <td>=</td>
207
+ <td class="context-item-value">&quot;http://www.ltsw.se/knbase/internet/%s.htp&quot;</td>
208
+ </tr>
209
+ <tr class="top-aligned-row context-row">
210
+ <td class="context-item-name">CONTACT_URL</td>
211
+ <td>=</td>
212
+ <td class="context-item-value">&quot;http://www.iana.org/assignments/contact-people.htm#%s&quot;</td>
213
+ </tr>
214
+ </table>
215
+ </div>
216
+ </div>
217
+
218
+
219
+
220
+ <div id="attribute-list">
221
+ <h3 class="section-bar">Attributes</h3>
222
+
223
+ <div class="name-list">
224
+ <table>
225
+ <tr class="top-aligned-row context-row">
226
+ <td class="context-item-name">content_type</td>
227
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
228
+ <td class="context-item-desc">
229
+ Returns the whole <a href="../MIME.html">MIME</a> content-type string.
230
+
231
+ <pre>
232
+ text/plain =&gt; text/plain
233
+ x-chemical/x-pdb =&gt; x-chemical/x-pdb
234
+ </pre>
235
+ </td>
236
+ </tr>
237
+ <tr class="top-aligned-row context-row">
238
+ <td class="context-item-name">default_encoding</td>
239
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
240
+ <td class="context-item-desc">
241
+ Returns the default encoding for the <a href="Type.html">MIME::Type</a>
242
+ based on the media type.
243
+
244
+ </td>
245
+ </tr>
246
+ <tr class="top-aligned-row context-row">
247
+ <td class="context-item-name">docs</td>
248
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
249
+ <td class="context-item-desc">
250
+ The documentation for this <a href="Type.html">MIME::Type</a>.
251
+ Documentation about media types will be found on a media type definition as
252
+ a comment. Documentation will be found through docs.
253
+
254
+ </td>
255
+ </tr>
256
+ <tr class="top-aligned-row context-row">
257
+ <td class="context-item-name">encoding</td>
258
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
259
+ <td class="context-item-desc">
260
+ The encoding (7bit, 8bit, quoted-printable, or base64) required to
261
+ transport the data of this content type safely across a network, which
262
+ roughly corresponds to Content-Transfer-Encoding. A value of <tt>nil</tt>
263
+ or <tt>:default</tt> will reset the encoding to the <a
264
+ href="Type.html#M000379">default_encoding</a> for the <a
265
+ href="Type.html">MIME::Type</a>. Raises ArgumentError if the encoding
266
+ provided is invalid.
267
+
268
+ <p>
269
+ If the encoding is not provided on construction, this will be either
270
+ &#8216;quoted-printable&#8217; (for text/* media types) and
271
+ &#8216;base64&#8217; for eveything else.
272
+ </p>
273
+ </td>
274
+ </tr>
275
+ <tr class="top-aligned-row context-row">
276
+ <td class="context-item-name">extensions</td>
277
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
278
+ <td class="context-item-desc">
279
+ The list of extensions which are known to be used for this <a
280
+ href="Type.html">MIME::Type</a>. Non-array values will be coerced into an
281
+ array with <a href="Type.html#M000398">to_a</a>. Array values will be
282
+ flattened and <tt>nil</tt> values removed.
283
+
284
+ </td>
285
+ </tr>
286
+ <tr class="top-aligned-row context-row">
287
+ <td class="context-item-name">media_type</td>
288
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
289
+ <td class="context-item-desc">
290
+ Returns the media type of the <a href="Type.html#M000384">simplified</a> <a
291
+ href="../MIME.html">MIME</a> type.
292
+
293
+ <pre>
294
+ text/plain =&gt; text
295
+ x-chemical/x-pdb =&gt; chemical
296
+ </pre>
297
+ </td>
298
+ </tr>
299
+ <tr class="top-aligned-row context-row">
300
+ <td class="context-item-name">obsolete</td>
301
+ <td class="context-item-value">&nbsp;[W]&nbsp;</td>
302
+ <td class="context-item-desc">
303
+ Sets the obsolescence indicator for this media type.
304
+
305
+ </td>
306
+ </tr>
307
+ <tr class="top-aligned-row context-row">
308
+ <td class="context-item-name">raw_media_type</td>
309
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
310
+ <td class="context-item-desc">
311
+ Returns the media type of the unmodified <a href="../MIME.html">MIME</a>
312
+ type.
313
+
314
+ <pre>
315
+ text/plain =&gt; text
316
+ x-chemical/x-pdb =&gt; x-chemical
317
+ </pre>
318
+ </td>
319
+ </tr>
320
+ <tr class="top-aligned-row context-row">
321
+ <td class="context-item-name">raw_sub_type</td>
322
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
323
+ <td class="context-item-desc">
324
+ Returns the media type of the unmodified <a href="../MIME.html">MIME</a>
325
+ type.
326
+
327
+ <pre>
328
+ text/plain =&gt; plain
329
+ x-chemical/x-pdb =&gt; x-pdb
330
+ </pre>
331
+ </td>
332
+ </tr>
333
+ <tr class="top-aligned-row context-row">
334
+ <td class="context-item-name">simplified</td>
335
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
336
+ <td class="context-item-desc">
337
+ The <a href="../MIME.html">MIME</a> types main- and sub-label can both
338
+ start with <tt>x-</tt>, which indicates that it is a non-registered name.
339
+ Of course, after registration this flag can disappear, adds to the
340
+ confusing proliferation of <a href="../MIME.html">MIME</a> types. The <a
341
+ href="Type.html#M000384">simplified</a> string has the <tt>x-</tt> removed
342
+ and are translated to lowercase.
343
+
344
+ <pre>
345
+ text/plain =&gt; text/plain
346
+ x-chemical/x-pdb =&gt; chemical/pdb
347
+ </pre>
348
+ </td>
349
+ </tr>
350
+ <tr class="top-aligned-row context-row">
351
+ <td class="context-item-name">sub_type</td>
352
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
353
+ <td class="context-item-desc">
354
+ Returns the sub-type of the <a href="Type.html#M000384">simplified</a> <a
355
+ href="../MIME.html">MIME</a> type.
356
+
357
+ <pre>
358
+ text/plain =&gt; plain
359
+ x-chemical/x-pdb =&gt; pdb
360
+ </pre>
361
+ </td>
362
+ </tr>
363
+ <tr class="top-aligned-row context-row">
364
+ <td class="context-item-name">system</td>
365
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
366
+ <td class="context-item-desc">
367
+ The regexp for the operating system that this <a
368
+ href="Type.html">MIME::Type</a> is specific to.
369
+
370
+ </td>
371
+ </tr>
372
+ <tr class="top-aligned-row context-row">
373
+ <td class="context-item-name">url</td>
374
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
375
+ <td class="context-item-desc">
376
+ The encoded URL list for this <a href="Type.html">MIME::Type</a>. See <a
377
+ href="Type.html#M000383">urls</a> for more information.
378
+
379
+ </td>
380
+ </tr>
381
+ <tr class="top-aligned-row context-row">
382
+ <td class="context-item-name">use_instead</td>
383
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
384
+ <td class="context-item-desc">
385
+ Returns the media type or types that should be used instead of this media
386
+ type, if it is obsolete. If there is no replacement media type, or it is
387
+ not obsolete, <tt>nil</tt> will be returned.
388
+
389
+ </td>
390
+ </tr>
391
+ </table>
392
+ </div>
393
+ </div>
394
+
395
+
396
+
397
+ <!-- if method_list -->
398
+ <div id="methods">
399
+ <h3 class="section-bar">Public Class methods</h3>
400
+
401
+ <div id="method-M000385" class="method-detail">
402
+ <a name="M000385"></a>
403
+
404
+ <div class="method-heading">
405
+ <a href="#M000385" class="method-signature">
406
+ <span class="method-name">from_array</span><span class="method-args">(*args) {|m if block_given?| ...}</span>
407
+ </a>
408
+ </div>
409
+
410
+ <div class="method-description">
411
+ <p>
412
+ Creates a <a href="Type.html">MIME::Type</a> from an array in the form of:
413
+ </p>
414
+ <pre>
415
+ [type-name, [extensions], encoding, system]
416
+ </pre>
417
+ <p>
418
+ <tt>extensions</tt>, <tt>encoding</tt>, and <tt>system</tt> are optional.
419
+ </p>
420
+ <pre>
421
+ MIME::Type.from_array(&quot;application/x-ruby&quot;, ['rb'], '8bit')
422
+ MIME::Type.from_array([&quot;application/x-ruby&quot;, ['rb'], '8bit'])
423
+ </pre>
424
+ <p>
425
+ These are equivalent to:
426
+ </p>
427
+ <pre>
428
+ MIME::Type.new('application/x-ruby') do |t|
429
+ t.extensions = %w(rb)
430
+ t.encoding = '8bit'
431
+ end
432
+ </pre>
433
+ <p><a class="source-toggle" href="#"
434
+ onclick="toggleCode('M000385-source');return false;">[Source]</a></p>
435
+ <div class="method-source-code" id="M000385-source">
436
+ <pre>
437
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 328</span>
438
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">from_array</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>) <span class="ruby-comment cmt">#:yields MIME::Type.new:</span>
439
+ <span class="ruby-comment cmt"># Dereferences the array one level, if necessary.</span>
440
+ <span class="ruby-identifier">args</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Array</span>)
441
+
442
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span>.<span class="ruby-identifier">between?</span>(<span class="ruby-value">1</span>, <span class="ruby-value">8</span>)
443
+ <span class="ruby-identifier">m</span> = <span class="ruby-constant">MIME</span><span class="ruby-operator">::</span><span class="ruby-constant">Type</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
444
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">extensions</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
445
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">encoding</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">2</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">2</span>
446
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">system</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">3</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">3</span>
447
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">obsolete</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">4</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">4</span>
448
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">docs</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">5</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">5</span>
449
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">url</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">6</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">6</span>
450
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">registered</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">7</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">7</span>
451
+ <span class="ruby-keyword kw">end</span>
452
+ <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">m</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
453
+ <span class="ruby-keyword kw">else</span>
454
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;Array provided must contain between one and eight elements.&quot;</span>
455
+ <span class="ruby-keyword kw">end</span>
456
+ <span class="ruby-identifier">m</span>
457
+ <span class="ruby-keyword kw">end</span>
458
+ </pre>
459
+ </div>
460
+ </div>
461
+ </div>
462
+
463
+ <div id="method-M000386" class="method-detail">
464
+ <a name="M000386"></a>
465
+
466
+ <div class="method-heading">
467
+ <a href="#M000386" class="method-signature">
468
+ <span class="method-name">from_hash</span><span class="method-args">(hash) {|m if block_given?| ...}</span>
469
+ </a>
470
+ </div>
471
+
472
+ <div class="method-description">
473
+ <p>
474
+ Creates a <a href="Type.html">MIME::Type</a> from a hash. Keys are
475
+ case-insensitive, dashes may be replaced with underscores, and the internal
476
+ Symbol of the lowercase-underscore version can be used as well. That is,
477
+ Content-<a href="Type.html">Type</a> can be provided as content-type,
478
+ Content_Type, content_type, or :content_type.
479
+ </p>
480
+ <p>
481
+ Known keys are <tt>Content-<a href="Type.html">Type</a></tt>,
482
+ <tt>Content-Transfer-Encoding</tt>, <tt>Extensions</tt>, and
483
+ <tt>System</tt>.
484
+ </p>
485
+ <pre>
486
+ MIME::Type.from_hash('Content-Type' =&gt; 'text/x-yaml',
487
+ 'Content-Transfer-Encoding' =&gt; '8bit',
488
+ 'System' =&gt; 'linux',
489
+ 'Extensions' =&gt; ['yaml', 'yml'])
490
+ </pre>
491
+ <p>
492
+ This is equivalent to:
493
+ </p>
494
+ <pre>
495
+ MIME::Type.new('text/x-yaml') do |t|
496
+ t.encoding = '8bit'
497
+ t.system = 'linux'
498
+ t.extensions = ['yaml', 'yml']
499
+ end
500
+ </pre>
501
+ <p><a class="source-toggle" href="#"
502
+ onclick="toggleCode('M000386-source');return false;">[Source]</a></p>
503
+ <div class="method-source-code" id="M000386-source">
504
+ <pre>
505
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 371</span>
506
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">from_hash</span>(<span class="ruby-identifier">hash</span>) <span class="ruby-comment cmt">#:yields MIME::Type.new:</span>
507
+ <span class="ruby-identifier">type</span> = {}
508
+ <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
509
+ <span class="ruby-identifier">type</span>[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-value str">'A-Z'</span>, <span class="ruby-value str">'a-z'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/-/</span>, <span class="ruby-value str">'_'</span>).<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">v</span>
510
+ <span class="ruby-keyword kw">end</span>
511
+
512
+ <span class="ruby-identifier">m</span> = <span class="ruby-constant">MIME</span><span class="ruby-operator">::</span><span class="ruby-constant">Type</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">type</span>[<span class="ruby-identifier">:content_type</span>]) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
513
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">extensions</span> = <span class="ruby-identifier">type</span>[<span class="ruby-identifier">:extensions</span>]
514
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">encoding</span> = <span class="ruby-identifier">type</span>[<span class="ruby-identifier">:content_transfer_encoding</span>]
515
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">system</span> = <span class="ruby-identifier">type</span>[<span class="ruby-identifier">:system</span>]
516
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">obsolete</span> = <span class="ruby-identifier">type</span>[<span class="ruby-identifier">:obsolete</span>]
517
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">docs</span> = <span class="ruby-identifier">type</span>[<span class="ruby-identifier">:docs</span>]
518
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">url</span> = <span class="ruby-identifier">type</span>[<span class="ruby-identifier">:url</span>]
519
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">registered</span> = <span class="ruby-identifier">type</span>[<span class="ruby-identifier">:registered</span>]
520
+ <span class="ruby-keyword kw">end</span>
521
+
522
+ <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">m</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
523
+ <span class="ruby-identifier">m</span>
524
+ <span class="ruby-keyword kw">end</span>
525
+ </pre>
526
+ </div>
527
+ </div>
528
+ </div>
529
+
530
+ <div id="method-M000387" class="method-detail">
531
+ <a name="M000387"></a>
532
+
533
+ <div class="method-heading">
534
+ <a href="#M000387" class="method-signature">
535
+ <span class="method-name">from_mime_type</span><span class="method-args">(mime_type) {|m if block_given?| ...}</span>
536
+ </a>
537
+ </div>
538
+
539
+ <div class="method-description">
540
+ <p>
541
+ Essentially a copy constructor.
542
+ </p>
543
+ <pre>
544
+ MIME::Type.from_mime_type(plaintext)
545
+ </pre>
546
+ <p>
547
+ is equivalent to:
548
+ </p>
549
+ <pre>
550
+ MIME::Type.new(plaintext.content_type.dup) do |t|
551
+ t.extensions = plaintext.extensions.dup
552
+ t.system = plaintext.system.dup
553
+ t.encoding = plaintext.encoding.dup
554
+ end
555
+ </pre>
556
+ <p><a class="source-toggle" href="#"
557
+ onclick="toggleCode('M000387-source');return false;">[Source]</a></p>
558
+ <div class="method-source-code" id="M000387-source">
559
+ <pre>
560
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 402</span>
561
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">from_mime_type</span>(<span class="ruby-identifier">mime_type</span>) <span class="ruby-comment cmt">#:yields the new MIME::Type:</span>
562
+ <span class="ruby-identifier">m</span> = <span class="ruby-constant">MIME</span><span class="ruby-operator">::</span><span class="ruby-constant">Type</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">mime_type</span>.<span class="ruby-identifier">content_type</span>.<span class="ruby-identifier">dup</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
563
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">extensions</span> = <span class="ruby-identifier">mime_type</span>.<span class="ruby-identifier">extensions</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">dup</span> }
564
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">url</span> = <span class="ruby-identifier">mime_type</span>.<span class="ruby-identifier">url</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">mime_type</span>.<span class="ruby-identifier">url</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">dup</span> }
565
+
566
+ <span class="ruby-identifier">mime_type</span>.<span class="ruby-identifier">system</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">system</span> = <span class="ruby-identifier">mime_type</span>.<span class="ruby-identifier">system</span>.<span class="ruby-identifier">dup</span>
567
+ <span class="ruby-identifier">mime_type</span>.<span class="ruby-identifier">encoding</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">encoding</span> = <span class="ruby-identifier">mime_type</span>.<span class="ruby-identifier">encoding</span>.<span class="ruby-identifier">dup</span>
568
+
569
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">obsolete</span> = <span class="ruby-identifier">mime_type</span>.<span class="ruby-identifier">obsolete?</span>
570
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">registered</span> = <span class="ruby-identifier">mime_type</span>.<span class="ruby-identifier">registered?</span>
571
+
572
+ <span class="ruby-identifier">mime_type</span>.<span class="ruby-identifier">docs</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">docs</span> = <span class="ruby-identifier">mime_type</span>.<span class="ruby-identifier">docs</span>.<span class="ruby-identifier">dup</span>
573
+
574
+ <span class="ruby-keyword kw">end</span>
575
+
576
+ <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">m</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
577
+ <span class="ruby-keyword kw">end</span>
578
+ </pre>
579
+ </div>
580
+ </div>
581
+ </div>
582
+
583
+ <div id="method-M000388" class="method-detail">
584
+ <a name="M000388"></a>
585
+
586
+ <div class="method-heading">
587
+ <a href="#M000388" class="method-signature">
588
+ <span class="method-name">new</span><span class="method-args">(content_type) {|self if block_given?| ...}</span>
589
+ </a>
590
+ </div>
591
+
592
+ <div class="method-description">
593
+ <p>
594
+ Builds a <a href="Type.html">MIME::Type</a> object from the provided <a
595
+ href="../MIME.html">MIME</a> Content <a href="Type.html">Type</a> value
596
+ (e.g., &#8216;text/plain&#8217; or &#8216;applicaton/x-eruby&#8217;). The
597
+ constructed object is yielded to an optional block for additional
598
+ configuration, such as associating extensions and encoding information.
599
+ </p>
600
+ <p><a class="source-toggle" href="#"
601
+ onclick="toggleCode('M000388-source');return false;">[Source]</a></p>
602
+ <div class="method-source-code" id="M000388-source">
603
+ <pre>
604
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 425</span>
605
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">content_type</span>) <span class="ruby-comment cmt">#:yields self:</span>
606
+ <span class="ruby-identifier">matchdata</span> = <span class="ruby-constant">MEDIA_TYPE_RE</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">content_type</span>)
607
+
608
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">matchdata</span>.<span class="ruby-identifier">nil?</span>
609
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidContentType</span>, <span class="ruby-node">&quot;Invalid Content-Type provided ('#{content_type}')&quot;</span>
610
+ <span class="ruby-keyword kw">end</span>
611
+
612
+ <span class="ruby-ivar">@content_type</span> = <span class="ruby-identifier">content_type</span>
613
+ <span class="ruby-ivar">@raw_media_type</span> = <span class="ruby-identifier">matchdata</span>.<span class="ruby-identifier">captures</span>[<span class="ruby-value">0</span>]
614
+ <span class="ruby-ivar">@raw_sub_type</span> = <span class="ruby-identifier">matchdata</span>.<span class="ruby-identifier">captures</span>[<span class="ruby-value">1</span>]
615
+
616
+ <span class="ruby-ivar">@simplified</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-ivar">@content_type</span>)
617
+ <span class="ruby-identifier">matchdata</span> = <span class="ruby-constant">MEDIA_TYPE_RE</span>.<span class="ruby-identifier">match</span>(<span class="ruby-ivar">@simplified</span>)
618
+ <span class="ruby-ivar">@media_type</span> = <span class="ruby-identifier">matchdata</span>.<span class="ruby-identifier">captures</span>[<span class="ruby-value">0</span>]
619
+ <span class="ruby-ivar">@sub_type</span> = <span class="ruby-identifier">matchdata</span>.<span class="ruby-identifier">captures</span>[<span class="ruby-value">1</span>]
620
+
621
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">extensions</span> = <span class="ruby-keyword kw">nil</span>
622
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">encoding</span> = <span class="ruby-identifier">:default</span>
623
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">system</span> = <span class="ruby-keyword kw">nil</span>
624
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">registered</span> = <span class="ruby-keyword kw">true</span>
625
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">url</span> = <span class="ruby-keyword kw">nil</span>
626
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">obsolete</span> = <span class="ruby-keyword kw">nil</span>
627
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">docs</span> = <span class="ruby-keyword kw">nil</span>
628
+
629
+ <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
630
+ <span class="ruby-keyword kw">end</span>
631
+ </pre>
632
+ </div>
633
+ </div>
634
+ </div>
635
+
636
+ <div id="method-M000384" class="method-detail">
637
+ <a name="M000384"></a>
638
+
639
+ <div class="method-heading">
640
+ <a href="#M000384" class="method-signature">
641
+ <span class="method-name">simplified</span><span class="method-args">(content_type)</span>
642
+ </a>
643
+ </div>
644
+
645
+ <div class="method-description">
646
+ <p>
647
+ The <a href="../MIME.html">MIME</a> types main- and sub-label can both
648
+ start with <tt>x-</tt>, which indicates that it is a non-registered name.
649
+ Of course, after registration this flag can disappear, adds to the
650
+ confusing proliferation of <a href="../MIME.html">MIME</a> types. The <a
651
+ href="Type.html#M000384">simplified</a> string has the <tt>x-</tt> removed
652
+ and are translated to lowercase.
653
+ </p>
654
+ <p><a class="source-toggle" href="#"
655
+ onclick="toggleCode('M000384-source');return false;">[Source]</a></p>
656
+ <div class="method-source-code" id="M000384-source">
657
+ <pre>
658
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 301</span>
659
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">simplified</span>(<span class="ruby-identifier">content_type</span>)
660
+ <span class="ruby-identifier">matchdata</span> = <span class="ruby-constant">MEDIA_TYPE_RE</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">content_type</span>)
661
+
662
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">matchdata</span>.<span class="ruby-identifier">nil?</span>
663
+ <span class="ruby-identifier">simplified</span> = <span class="ruby-keyword kw">nil</span>
664
+ <span class="ruby-keyword kw">else</span>
665
+ <span class="ruby-identifier">media_type</span> = <span class="ruby-identifier">matchdata</span>.<span class="ruby-identifier">captures</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-constant">UNREG_RE</span>, <span class="ruby-value str">''</span>)
666
+ <span class="ruby-identifier">subtype</span> = <span class="ruby-identifier">matchdata</span>.<span class="ruby-identifier">captures</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-constant">UNREG_RE</span>, <span class="ruby-value str">''</span>)
667
+ <span class="ruby-identifier">simplified</span> = <span class="ruby-node">&quot;#{media_type}/#{subtype}&quot;</span>
668
+ <span class="ruby-keyword kw">end</span>
669
+ <span class="ruby-identifier">simplified</span>
670
+ <span class="ruby-keyword kw">end</span>
671
+ </pre>
672
+ </div>
673
+ </div>
674
+ </div>
675
+
676
+ <h3 class="section-bar">Public Instance methods</h3>
677
+
678
+ <div id="method-M000376" class="method-detail">
679
+ <a name="M000376"></a>
680
+
681
+ <div class="method-heading">
682
+ <a href="#M000376" class="method-signature">
683
+ <span class="method-name">&lt;=&gt;</span><span class="method-args">(other)</span>
684
+ </a>
685
+ </div>
686
+
687
+ <div class="method-description">
688
+ <p>
689
+ Compares the <a href="Type.html">MIME::Type</a> against the exact content
690
+ type or the <a href="Type.html#M000384">simplified</a> type (the <a
691
+ href="Type.html#M000384">simplified</a> type will be used if comparing
692
+ against something that can be treated as a String with <a
693
+ href="Type.html#M000396">to_s</a>). In comparisons, this is done against
694
+ the lowercase version of the <a href="Type.html">MIME::Type</a>.
695
+ </p>
696
+ <p><a class="source-toggle" href="#"
697
+ onclick="toggleCode('M000376-source');return false;">[Source]</a></p>
698
+ <div class="method-source-code" id="M000376-source">
699
+ <pre>
700
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 71</span>
701
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;=&gt;</span>(<span class="ruby-identifier">other</span>)
702
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:content_type</span>)
703
+ <span class="ruby-ivar">@content_type</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">content_type</span>.<span class="ruby-identifier">downcase</span>
704
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_s</span>)
705
+ <span class="ruby-ivar">@simplified</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">simplified</span>(<span class="ruby-identifier">other</span>.<span class="ruby-identifier">to_s</span>)
706
+ <span class="ruby-keyword kw">else</span>
707
+ <span class="ruby-ivar">@content_type</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">downcase</span>
708
+ <span class="ruby-keyword kw">end</span>
709
+ <span class="ruby-keyword kw">end</span>
710
+ </pre>
711
+ </div>
712
+ </div>
713
+ </div>
714
+
715
+ <div id="method-M000391" class="method-detail">
716
+ <a name="M000391"></a>
717
+
718
+ <div class="method-heading">
719
+ <a href="#M000391" class="method-signature">
720
+ <span class="method-name">ascii?</span><span class="method-args">()</span>
721
+ </a>
722
+ </div>
723
+
724
+ <div class="method-description">
725
+ <p>
726
+ <a href="../MIME.html">MIME</a> types can be specified to be sent across a
727
+ network in particular formats. This method returns <tt>false</tt> when the
728
+ <a href="../MIME.html">MIME</a> type encoding is set to <tt>base64</tt>.
729
+ </p>
730
+ <p><a class="source-toggle" href="#"
731
+ onclick="toggleCode('M000391-source');return false;">[Source]</a></p>
732
+ <div class="method-source-code" id="M000391-source">
733
+ <pre>
734
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 476</span>
735
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ascii?</span>
736
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">binary?</span>
737
+ <span class="ruby-keyword kw">end</span>
738
+ </pre>
739
+ </div>
740
+ </div>
741
+ </div>
742
+
743
+ <div id="method-M000390" class="method-detail">
744
+ <a name="M000390"></a>
745
+
746
+ <div class="method-heading">
747
+ <a href="#M000390" class="method-signature">
748
+ <span class="method-name">binary?</span><span class="method-args">()</span>
749
+ </a>
750
+ </div>
751
+
752
+ <div class="method-description">
753
+ <p>
754
+ <a href="../MIME.html">MIME</a> types can be specified to be sent across a
755
+ network in particular formats. This method returns <tt>true</tt> when the
756
+ <a href="../MIME.html">MIME</a> type encoding is set to <tt>base64</tt>.
757
+ </p>
758
+ <p><a class="source-toggle" href="#"
759
+ onclick="toggleCode('M000390-source');return false;">[Source]</a></p>
760
+ <div class="method-source-code" id="M000390-source">
761
+ <pre>
762
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 469</span>
763
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">binary?</span>
764
+ <span class="ruby-ivar">@encoding</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'base64'</span>
765
+ <span class="ruby-keyword kw">end</span>
766
+ </pre>
767
+ </div>
768
+ </div>
769
+ </div>
770
+
771
+ <div id="method-M000395" class="method-detail">
772
+ <a name="M000395"></a>
773
+
774
+ <div class="method-heading">
775
+ <a href="#M000395" class="method-signature">
776
+ <span class="method-name">complete?</span><span class="method-args">()</span>
777
+ </a>
778
+ </div>
779
+
780
+ <div class="method-description">
781
+ <p>
782
+ Returns <tt>true</tt> if the <a href="Type.html">MIME::Type</a> specifies
783
+ an extension list, indicating that it is a complete <a
784
+ href="Type.html">MIME::Type</a>.
785
+ </p>
786
+ <p><a class="source-toggle" href="#"
787
+ onclick="toggleCode('M000395-source');return false;">[Source]</a></p>
788
+ <div class="method-source-code" id="M000395-source">
789
+ <pre>
790
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 499</span>
791
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">complete?</span>
792
+ <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@extensions</span>.<span class="ruby-identifier">empty?</span>
793
+ <span class="ruby-keyword kw">end</span>
794
+ </pre>
795
+ </div>
796
+ </div>
797
+ </div>
798
+
799
+ <div id="method-M000379" class="method-detail">
800
+ <a name="M000379"></a>
801
+
802
+ <div class="method-heading">
803
+ <a href="#M000379" class="method-signature">
804
+ <span class="method-name">default_encoding</span><span class="method-args">()</span>
805
+ </a>
806
+ </div>
807
+
808
+ <div class="method-description">
809
+ <p><a class="source-toggle" href="#"
810
+ onclick="toggleCode('M000379-source');return false;">[Source]</a></p>
811
+ <div class="method-source-code" id="M000379-source">
812
+ <pre>
813
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 211</span>
814
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default_encoding</span>
815
+ (<span class="ruby-ivar">@media_type</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'text'</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">'quoted-printable'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'base64'</span>
816
+ <span class="ruby-keyword kw">end</span>
817
+ </pre>
818
+ </div>
819
+ </div>
820
+ </div>
821
+
822
+ <div id="method-M000382" class="method-detail">
823
+ <a name="M000382"></a>
824
+
825
+ <div class="method-heading">
826
+ <a href="#M000382" class="method-signature">
827
+ <span class="method-name">docs=</span><span class="method-args">(d)</span>
828
+ </a>
829
+ </div>
830
+
831
+ <div class="method-description">
832
+ <p><a class="source-toggle" href="#"
833
+ onclick="toggleCode('M000382-source');return false;">[Source]</a></p>
834
+ <div class="method-source-code" id="M000382-source">
835
+ <pre>
836
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 237</span>
837
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">docs=</span>(<span class="ruby-identifier">d</span>)
838
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">d</span>
839
+ <span class="ruby-identifier">a</span> = <span class="ruby-identifier">d</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-node">%r{use-instead:#{MEDIA_TYPE_RE}}</span>)
840
+
841
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">empty?</span>
842
+ <span class="ruby-ivar">@use_instead</span> = <span class="ruby-keyword kw">nil</span>
843
+ <span class="ruby-keyword kw">else</span>
844
+ <span class="ruby-ivar">@use_instead</span> = <span class="ruby-identifier">a</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">el</span><span class="ruby-operator">|</span> <span class="ruby-node">&quot;#{el[0]}/#{el[1]}&quot;</span> }
845
+ <span class="ruby-keyword kw">end</span>
846
+ <span class="ruby-keyword kw">end</span>
847
+ <span class="ruby-ivar">@docs</span> = <span class="ruby-identifier">d</span>
848
+ <span class="ruby-keyword kw">end</span>
849
+ </pre>
850
+ </div>
851
+ </div>
852
+ </div>
853
+
854
+ <div id="method-M000378" class="method-detail">
855
+ <a name="M000378"></a>
856
+
857
+ <div class="method-heading">
858
+ <a href="#M000378" class="method-signature">
859
+ <span class="method-name">eql?</span><span class="method-args">(other)</span>
860
+ </a>
861
+ </div>
862
+
863
+ <div class="method-description">
864
+ <p>
865
+ Returns <tt>true</tt> if the other object is a <a
866
+ href="Type.html">MIME::Type</a> and the content types match.
867
+ </p>
868
+ <p><a class="source-toggle" href="#"
869
+ onclick="toggleCode('M000378-source');return false;">[Source]</a></p>
870
+ <div class="method-source-code" id="M000378-source">
871
+ <pre>
872
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 127</span>
873
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">other</span>)
874
+ <span class="ruby-identifier">other</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>) <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>
875
+ <span class="ruby-keyword kw">end</span>
876
+ </pre>
877
+ </div>
878
+ </div>
879
+ </div>
880
+
881
+ <div id="method-M000375" class="method-detail">
882
+ <a name="M000375"></a>
883
+
884
+ <div class="method-heading">
885
+ <a href="#M000375" class="method-signature">
886
+ <span class="method-name">like?</span><span class="method-args">(other)</span>
887
+ </a>
888
+ </div>
889
+
890
+ <div class="method-description">
891
+ <p>
892
+ Returns <tt>true</tt> if the <a href="Type.html#M000384">simplified</a>
893
+ type matches the current
894
+ </p>
895
+ <p><a class="source-toggle" href="#"
896
+ onclick="toggleCode('M000375-source');return false;">[Source]</a></p>
897
+ <div class="method-source-code" id="M000375-source">
898
+ <pre>
899
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 59</span>
900
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">like?</span>(<span class="ruby-identifier">other</span>)
901
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:simplified</span>)
902
+ <span class="ruby-ivar">@simplified</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">simplified</span>
903
+ <span class="ruby-keyword kw">else</span>
904
+ <span class="ruby-ivar">@simplified</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">simplified</span>(<span class="ruby-identifier">other</span>)
905
+ <span class="ruby-keyword kw">end</span>
906
+ <span class="ruby-keyword kw">end</span>
907
+ </pre>
908
+ </div>
909
+ </div>
910
+ </div>
911
+
912
+ <div id="method-M000381" class="method-detail">
913
+ <a name="M000381"></a>
914
+
915
+ <div class="method-heading">
916
+ <a href="#M000381" class="method-signature">
917
+ <span class="method-name">obsolete?</span><span class="method-args">()</span>
918
+ </a>
919
+ </div>
920
+
921
+ <div class="method-description">
922
+ <p>
923
+ Returns <tt>true</tt> if the media type is obsolete.
924
+ </p>
925
+ <p><a class="source-toggle" href="#"
926
+ onclick="toggleCode('M000381-source');return false;">[Source]</a></p>
927
+ <div class="method-source-code" id="M000381-source">
928
+ <pre>
929
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 226</span>
930
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">obsolete?</span>
931
+ <span class="ruby-ivar">@obsolete</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span>
932
+ <span class="ruby-keyword kw">end</span>
933
+ </pre>
934
+ </div>
935
+ </div>
936
+ </div>
937
+
938
+ <div id="method-M000394" class="method-detail">
939
+ <a name="M000394"></a>
940
+
941
+ <div class="method-heading">
942
+ <a href="#M000394" class="method-signature">
943
+ <span class="method-name">platform?</span><span class="method-args">()</span>
944
+ </a>
945
+ </div>
946
+
947
+ <div class="method-description">
948
+ <p>
949
+ Returns <tt>true</tt> if the <a href="Type.html">MIME::Type</a> is specific
950
+ to the current operating system as represented by RUBY_PLATFORM.
951
+ </p>
952
+ <p><a class="source-toggle" href="#"
953
+ onclick="toggleCode('M000394-source');return false;">[Source]</a></p>
954
+ <div class="method-source-code" id="M000394-source">
955
+ <pre>
956
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 493</span>
957
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">platform?</span>
958
+ <span class="ruby-identifier">system?</span> <span class="ruby-keyword kw">and</span> (<span class="ruby-constant">RUBY_PLATFORM</span> <span class="ruby-operator">=~</span> <span class="ruby-ivar">@system</span>)
959
+ <span class="ruby-keyword kw">end</span>
960
+ </pre>
961
+ </div>
962
+ </div>
963
+ </div>
964
+
965
+ <div id="method-M000377" class="method-detail">
966
+ <a name="M000377"></a>
967
+
968
+ <div class="method-heading">
969
+ <a href="#M000377" class="method-signature">
970
+ <span class="method-name">priority_compare</span><span class="method-args">(other)</span>
971
+ </a>
972
+ </div>
973
+
974
+ <div class="method-description">
975
+ <p>
976
+ Compares the <a href="Type.html">MIME::Type</a> based on how reliable it is
977
+ before doing a normal &lt;=&gt; comparison. Used by <a
978
+ href="Types.html">MIME::Types</a>#[] to sort types. The comparisons
979
+ involved are:
980
+ </p>
981
+ <ol>
982
+ <li>self.simplified &lt;=&gt; other.simplified (ensures that we don&#8216;t try
983
+ to compare different types)
984
+
985
+ </li>
986
+ <li>IANA-registered definitions &gt; other definitions.
987
+
988
+ </li>
989
+ <li>Generic definitions &gt; platform definitions.
990
+
991
+ </li>
992
+ <li>Complete definitions &gt; incomplete definitions.
993
+
994
+ </li>
995
+ <li>Current definitions &gt; obsolete definitions.
996
+
997
+ </li>
998
+ <li>Obselete with use-instead references &gt; obsolete without.
999
+
1000
+ </li>
1001
+ <li>Obsolete use-instead definitions are compared.
1002
+
1003
+ </li>
1004
+ </ol>
1005
+ <p><a class="source-toggle" href="#"
1006
+ onclick="toggleCode('M000377-source');return false;">[Source]</a></p>
1007
+ <div class="method-source-code" id="M000377-source">
1008
+ <pre>
1009
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 93</span>
1010
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">priority_compare</span>(<span class="ruby-identifier">other</span>)
1011
+ <span class="ruby-identifier">pc</span> = <span class="ruby-identifier">simplified</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">simplified</span>
1012
+
1013
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pc</span>.<span class="ruby-identifier">zero?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">registered?</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">registered?</span>
1014
+ <span class="ruby-identifier">pc</span> = <span class="ruby-identifier">registered?</span> <span class="ruby-value">? </span><span class="ruby-operator">-</span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">1</span>
1015
+ <span class="ruby-keyword kw">end</span>
1016
+
1017
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pc</span>.<span class="ruby-identifier">zero?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">platform?</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">platform?</span>
1018
+ <span class="ruby-identifier">pc</span> = <span class="ruby-identifier">platform?</span> <span class="ruby-value">? </span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">-1</span>
1019
+ <span class="ruby-keyword kw">end</span>
1020
+
1021
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pc</span>.<span class="ruby-identifier">zero?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">complete?</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">complete?</span>
1022
+ <span class="ruby-identifier">pc</span> = <span class="ruby-identifier">complete?</span> <span class="ruby-value">? </span><span class="ruby-operator">-</span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">1</span>
1023
+ <span class="ruby-keyword kw">end</span>
1024
+
1025
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pc</span>.<span class="ruby-identifier">zero?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">obsolete?</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">obsolete?</span>
1026
+ <span class="ruby-identifier">pc</span> = <span class="ruby-identifier">obsolete?</span> <span class="ruby-value">? </span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">-1</span>
1027
+ <span class="ruby-keyword kw">end</span>
1028
+
1029
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pc</span>.<span class="ruby-identifier">zero?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">obsolete?</span> <span class="ruby-keyword kw">and</span> (<span class="ruby-identifier">use_instead</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">use_instead</span>)
1030
+ <span class="ruby-identifier">pc</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">use_instead</span>.<span class="ruby-identifier">nil?</span>
1031
+ <span class="ruby-value">-1</span>
1032
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">use_instead</span>.<span class="ruby-identifier">nil?</span>
1033
+ <span class="ruby-value">1</span>
1034
+ <span class="ruby-keyword kw">else</span>
1035
+ <span class="ruby-identifier">use_instead</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">use_instead</span>
1036
+ <span class="ruby-keyword kw">end</span>
1037
+ <span class="ruby-keyword kw">end</span>
1038
+
1039
+ <span class="ruby-identifier">pc</span>
1040
+ <span class="ruby-keyword kw">end</span>
1041
+ </pre>
1042
+ </div>
1043
+ </div>
1044
+ </div>
1045
+
1046
+ <div id="method-M000389" class="method-detail">
1047
+ <a name="M000389"></a>
1048
+
1049
+ <div class="method-heading">
1050
+ <a href="#M000389" class="method-signature">
1051
+ <span class="method-name">registered?</span><span class="method-args">()</span>
1052
+ </a>
1053
+ </div>
1054
+
1055
+ <div class="method-description">
1056
+ <p>
1057
+ <a href="../MIME.html">MIME</a> content-types which are not regestered by
1058
+ IANA nor defined in RFCs are required to start with <tt>x-</tt>. This
1059
+ counts as well for a <a href="Type.html#M000388">new</a> media type as well
1060
+ as a <a href="Type.html#M000388">new</a> sub-type of an existing media
1061
+ type. If either the media-type or the content-type begins with <tt>x-</tt>,
1062
+ this method will return <tt>false</tt>.
1063
+ </p>
1064
+ <p><a class="source-toggle" href="#"
1065
+ onclick="toggleCode('M000389-source');return false;">[Source]</a></p>
1066
+ <div class="method-source-code" id="M000389-source">
1067
+ <pre>
1068
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 457</span>
1069
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">registered?</span>
1070
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@raw_media_type</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">UNREG_RE</span>) <span class="ruby-operator">||</span> (<span class="ruby-ivar">@raw_sub_type</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">UNREG_RE</span>)
1071
+ <span class="ruby-keyword kw">false</span>
1072
+ <span class="ruby-keyword kw">else</span>
1073
+ <span class="ruby-ivar">@registered</span>
1074
+ <span class="ruby-keyword kw">end</span>
1075
+ <span class="ruby-keyword kw">end</span>
1076
+ </pre>
1077
+ </div>
1078
+ </div>
1079
+ </div>
1080
+
1081
+ <div id="method-M000392" class="method-detail">
1082
+ <a name="M000392"></a>
1083
+
1084
+ <div class="method-heading">
1085
+ <a href="#M000392" class="method-signature">
1086
+ <span class="method-name">signature?</span><span class="method-args">()</span>
1087
+ </a>
1088
+ </div>
1089
+
1090
+ <div class="method-description">
1091
+ <p>
1092
+ Returns <tt>true</tt> when the <a href="Type.html#M000384">simplified</a>
1093
+ <a href="../MIME.html">MIME</a> type is in the list of known digital
1094
+ signatures.
1095
+ </p>
1096
+ <p><a class="source-toggle" href="#"
1097
+ onclick="toggleCode('M000392-source');return false;">[Source]</a></p>
1098
+ <div class="method-source-code" id="M000392-source">
1099
+ <pre>
1100
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 482</span>
1101
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">signature?</span>
1102
+ <span class="ruby-constant">SIGNATURES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-ivar">@simplified</span>.<span class="ruby-identifier">downcase</span>)
1103
+ <span class="ruby-keyword kw">end</span>
1104
+ </pre>
1105
+ </div>
1106
+ </div>
1107
+ </div>
1108
+
1109
+ <div id="method-M000393" class="method-detail">
1110
+ <a name="M000393"></a>
1111
+
1112
+ <div class="method-heading">
1113
+ <a href="#M000393" class="method-signature">
1114
+ <span class="method-name">system?</span><span class="method-args">()</span>
1115
+ </a>
1116
+ </div>
1117
+
1118
+ <div class="method-description">
1119
+ <p>
1120
+ Returns <tt>true</tt> if the <a href="Type.html">MIME::Type</a> is specific
1121
+ to an operating system.
1122
+ </p>
1123
+ <p><a class="source-toggle" href="#"
1124
+ onclick="toggleCode('M000393-source');return false;">[Source]</a></p>
1125
+ <div class="method-source-code" id="M000393-source">
1126
+ <pre>
1127
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 487</span>
1128
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">system?</span>
1129
+ <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@system</span>.<span class="ruby-identifier">nil?</span>
1130
+ <span class="ruby-keyword kw">end</span>
1131
+ </pre>
1132
+ </div>
1133
+ </div>
1134
+ </div>
1135
+
1136
+ <div id="method-M000398" class="method-detail">
1137
+ <a name="M000398"></a>
1138
+
1139
+ <div class="method-heading">
1140
+ <a href="#M000398" class="method-signature">
1141
+ <span class="method-name">to_a</span><span class="method-args">()</span>
1142
+ </a>
1143
+ </div>
1144
+
1145
+ <div class="method-description">
1146
+ <p>
1147
+ Returns the <a href="../MIME.html">MIME</a> type as an array suitable for
1148
+ use with <a href="Type.html#M000385">MIME::Type.from_array</a>.
1149
+ </p>
1150
+ <p><a class="source-toggle" href="#"
1151
+ onclick="toggleCode('M000398-source');return false;">[Source]</a></p>
1152
+ <div class="method-source-code" id="M000398-source">
1153
+ <pre>
1154
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 515</span>
1155
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_a</span>
1156
+ [ <span class="ruby-ivar">@content_type</span>, <span class="ruby-ivar">@extensions</span>, <span class="ruby-ivar">@encoding</span>, <span class="ruby-ivar">@system</span>, <span class="ruby-ivar">@obsolete</span>, <span class="ruby-ivar">@docs</span>,
1157
+ <span class="ruby-ivar">@url</span>, <span class="ruby-identifier">registered?</span> ]
1158
+ <span class="ruby-keyword kw">end</span>
1159
+ </pre>
1160
+ </div>
1161
+ </div>
1162
+ </div>
1163
+
1164
+ <div id="method-M000399" class="method-detail">
1165
+ <a name="M000399"></a>
1166
+
1167
+ <div class="method-heading">
1168
+ <a href="#M000399" class="method-signature">
1169
+ <span class="method-name">to_hash</span><span class="method-args">()</span>
1170
+ </a>
1171
+ </div>
1172
+
1173
+ <div class="method-description">
1174
+ <p>
1175
+ Returns the <a href="../MIME.html">MIME</a> type as an array suitable for
1176
+ use with <a href="Type.html#M000386">MIME::Type.from_hash</a>.
1177
+ </p>
1178
+ <p><a class="source-toggle" href="#"
1179
+ onclick="toggleCode('M000399-source');return false;">[Source]</a></p>
1180
+ <div class="method-source-code" id="M000399-source">
1181
+ <pre>
1182
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 522</span>
1183
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_hash</span>
1184
+ { <span class="ruby-value str">'Content-Type'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@content_type</span>,
1185
+ <span class="ruby-value str">'Content-Transfer-Encoding'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@encoding</span>,
1186
+ <span class="ruby-value str">'Extensions'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@extensions</span>,
1187
+ <span class="ruby-value str">'System'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@system</span>,
1188
+ <span class="ruby-value str">'Obsolete'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@obsolete</span>,
1189
+ <span class="ruby-value str">'Docs'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@docs</span>,
1190
+ <span class="ruby-value str">'URL'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@url</span>,
1191
+ <span class="ruby-value str">'Registered'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">registered?</span>,
1192
+ }
1193
+ <span class="ruby-keyword kw">end</span>
1194
+ </pre>
1195
+ </div>
1196
+ </div>
1197
+ </div>
1198
+
1199
+ <div id="method-M000396" class="method-detail">
1200
+ <a name="M000396"></a>
1201
+
1202
+ <div class="method-heading">
1203
+ <a href="#M000396" class="method-signature">
1204
+ <span class="method-name">to_s</span><span class="method-args">()</span>
1205
+ </a>
1206
+ </div>
1207
+
1208
+ <div class="method-description">
1209
+ <p>
1210
+ Returns the <a href="../MIME.html">MIME</a> type as a string.
1211
+ </p>
1212
+ <p><a class="source-toggle" href="#"
1213
+ onclick="toggleCode('M000396-source');return false;">[Source]</a></p>
1214
+ <div class="method-source-code" id="M000396-source">
1215
+ <pre>
1216
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 504</span>
1217
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
1218
+ <span class="ruby-ivar">@content_type</span>
1219
+ <span class="ruby-keyword kw">end</span>
1220
+ </pre>
1221
+ </div>
1222
+ </div>
1223
+ </div>
1224
+
1225
+ <div id="method-M000397" class="method-detail">
1226
+ <a name="M000397"></a>
1227
+
1228
+ <div class="method-heading">
1229
+ <a href="#M000397" class="method-signature">
1230
+ <span class="method-name">to_str</span><span class="method-args">()</span>
1231
+ </a>
1232
+ </div>
1233
+
1234
+ <div class="method-description">
1235
+ <p>
1236
+ Returns the <a href="../MIME.html">MIME</a> type as a string for implicit
1237
+ conversions.
1238
+ </p>
1239
+ <p><a class="source-toggle" href="#"
1240
+ onclick="toggleCode('M000397-source');return false;">[Source]</a></p>
1241
+ <div class="method-source-code" id="M000397-source">
1242
+ <pre>
1243
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 509</span>
1244
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_str</span>
1245
+ <span class="ruby-ivar">@content_type</span>
1246
+ <span class="ruby-keyword kw">end</span>
1247
+ </pre>
1248
+ </div>
1249
+ </div>
1250
+ </div>
1251
+
1252
+ <div id="method-M000383" class="method-detail">
1253
+ <a name="M000383"></a>
1254
+
1255
+ <div class="method-heading">
1256
+ <a href="#M000383" class="method-signature">
1257
+ <span class="method-name">urls</span><span class="method-args">()</span>
1258
+ </a>
1259
+ </div>
1260
+
1261
+ <div class="method-description">
1262
+ <p>
1263
+ The decoded URL list for this <a href="Type.html">MIME::Type</a>. The
1264
+ special URL value IANA will be translated into:
1265
+ </p>
1266
+ <pre>
1267
+ http://www.iana.org/assignments/media-types/&lt;mediatype&gt;/&lt;subtype&gt;
1268
+ </pre>
1269
+ <p>
1270
+ The special URL value RFC### will be translated into:
1271
+ </p>
1272
+ <pre>
1273
+ http://www.rfc-editor.org/rfc/rfc###.txt
1274
+ </pre>
1275
+ <p>
1276
+ The special URL value DRAFT:name will be translated into:
1277
+ </p>
1278
+ <pre>
1279
+ https://datatracker.ietf.org/public/idindex.cgi?
1280
+ command=id_detail&amp;filename=&lt;name&gt;
1281
+ </pre>
1282
+ <p>
1283
+ The special URL value LTSW will be translated into:
1284
+ </p>
1285
+ <pre>
1286
+ http://www.ltsw.se/knbase/internet/&lt;mediatype&gt;.htp
1287
+ </pre>
1288
+ <p>
1289
+ The special URL value [token] will be translated into:
1290
+ </p>
1291
+ <pre>
1292
+ http://www.iana.org/assignments/contact-people.htm#&lt;token&gt;
1293
+ </pre>
1294
+ <p>
1295
+ These values will be accessible through <a
1296
+ href="Type.html#M000383">urls</a>, which always returns an array.
1297
+ </p>
1298
+ <p><a class="source-toggle" href="#"
1299
+ onclick="toggleCode('M000383-source');return false;">[Source]</a></p>
1300
+ <div class="method-source-code" id="M000383-source">
1301
+ <pre>
1302
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 272</span>
1303
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">urls</span>
1304
+ <span class="ruby-ivar">@url</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">el</span><span class="ruby-operator">|</span>
1305
+ <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">el</span>
1306
+ <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%r{^IANA$}</span>
1307
+ <span class="ruby-constant">IANA_URL</span> <span class="ruby-operator">%</span> [ <span class="ruby-ivar">@media_type</span>, <span class="ruby-ivar">@sub_type</span> ]
1308
+ <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%r{^RFC(\d+)$}</span>
1309
+ <span class="ruby-constant">RFC_URL</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">$1</span>
1310
+ <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%r{^DRAFT:(.+)$}</span>
1311
+ <span class="ruby-constant">DRAFT_URL</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">$1</span>
1312
+ <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%r{^LTSW$}</span>
1313
+ <span class="ruby-constant">LTSW_URL</span> <span class="ruby-operator">%</span> <span class="ruby-ivar">@media_type</span>
1314
+ <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%r&lt;^\{([^=]+)=([^\]]+)\}&gt;</span>
1315
+ [<span class="ruby-identifier">$1</span>, <span class="ruby-identifier">$2</span>]
1316
+ <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%r{^\[([^=]+)=([^\]]+)\]}</span>
1317
+ [<span class="ruby-identifier">$1</span>, <span class="ruby-constant">CONTACT_URL</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">$2</span>]
1318
+ <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%r{^\[([^\]]+)\]}</span>
1319
+ <span class="ruby-constant">CONTACT_URL</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">$1</span>
1320
+ <span class="ruby-keyword kw">else</span>
1321
+ <span class="ruby-identifier">el</span>
1322
+ <span class="ruby-keyword kw">end</span>
1323
+ <span class="ruby-keyword kw">end</span>
1324
+ <span class="ruby-keyword kw">end</span>
1325
+ </pre>
1326
+ </div>
1327
+ </div>
1328
+ </div>
1329
+
1330
+ <div id="method-M000380" class="method-detail">
1331
+ <a name="M000380"></a>
1332
+
1333
+ <div class="method-heading">
1334
+ <a href="#M000380" class="method-signature">
1335
+ <span class="method-name">use_instead</span><span class="method-args">()</span>
1336
+ </a>
1337
+ </div>
1338
+
1339
+ <div class="method-description">
1340
+ <p><a class="source-toggle" href="#"
1341
+ onclick="toggleCode('M000380-source');return false;">[Source]</a></p>
1342
+ <div class="method-source-code" id="M000380-source">
1343
+ <pre>
1344
+ <span class="ruby-comment cmt"># File lib/mime-types-1.16/lib/mime/types.rb, line 220</span>
1345
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">use_instead</span>
1346
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@obsolete</span>
1347
+ <span class="ruby-ivar">@use_instead</span>
1348
+ <span class="ruby-keyword kw">end</span>
1349
+ </pre>
1350
+ </div>
1351
+ </div>
1352
+ </div>
1353
+
1354
+
1355
+ </div>
1356
+
1357
+
1358
+ </div>
1359
+
1360
+
1361
+ <div id="validator-badges">
1362
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
1363
+ </div>
1364
+
1365
+ </body>
1366
+ </html>