kinetic_sdk 5.0.14 → 5.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -0
- data/gems/{mime-types-3.1/Code-of-Conduct.rdoc → mime-types-3.3.1/Code-of-Conduct.md} +19 -20
- data/gems/{mime-types-3.1/Contributing.rdoc → mime-types-3.3.1/Contributing.md} +67 -54
- data/gems/mime-types-3.3.1/History.md +240 -0
- data/gems/{mime-types-data-3.2016.0521 → mime-types-3.3.1}/Licence.md +1 -1
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/Manifest.txt +4 -4
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/README.rdoc +5 -14
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/Rakefile +43 -13
- data/gems/mime-types-3.3.1/lib/mime-types.rb +3 -0
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/type.rb +60 -46
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/type/columnar.rb +4 -2
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types.rb +11 -8
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/_columnar.rb +10 -9
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/cache.rb +7 -5
- data/gems/mime-types-3.3.1/lib/mime/types/columnar.rb +3 -0
- data/gems/mime-types-3.3.1/lib/mime/types/container.rb +96 -0
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/deprecations.rb +3 -3
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/full.rb +2 -0
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/loader.rb +2 -4
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/logger.rb +3 -1
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/registry.rb +12 -3
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/bad-fixtures/malformed +0 -0
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/fixture/json.json +0 -0
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/fixture/old-data +0 -0
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/fixture/yaml.yaml +0 -0
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/minitest_helper.rb +1 -1
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_type.rb +33 -26
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_types.rb +33 -25
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_types_cache.rb +15 -6
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_types_class.rb +18 -14
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_types_lazy.rb +10 -4
- data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_types_loader.rb +1 -1
- data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/Code-of-Conduct.md +10 -10
- data/gems/mime-types-data-3.2021.0225/Contributing.md +224 -0
- data/gems/mime-types-data-3.2021.0225/History.md +468 -0
- data/gems/{mime-types-3.1/Licence.rdoc → mime-types-data-3.2021.0225/Licence.md} +3 -3
- data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/Manifest.txt +13 -0
- data/gems/mime-types-data-3.2021.0225/README.md +63 -0
- data/gems/mime-types-data-3.2021.0225/Rakefile +159 -0
- data/gems/mime-types-data-3.2021.0225/data/mime-types.json +1 -0
- data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.content_type.column +364 -13
- data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.docs.column +351 -0
- data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.encoding.column +351 -0
- data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.flags.column +352 -1
- data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.friendly.column +351 -0
- data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.pext.column +351 -0
- data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.use_instead.column +351 -0
- data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.xrefs.column +480 -129
- data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/lib/mime-types-data.rb +0 -0
- data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/lib/mime/types/data.rb +1 -1
- data/gems/mime-types-data-3.2021.0225/types/application.yaml +16933 -0
- data/gems/mime-types-data-3.2021.0225/types/audio.yaml +1714 -0
- data/gems/mime-types-data-3.2021.0225/types/chemical.yaml +71 -0
- data/gems/mime-types-data-3.2021.0225/types/conference.yaml +9 -0
- data/gems/mime-types-data-3.2021.0225/types/drawing.yaml +15 -0
- data/gems/mime-types-data-3.2021.0225/types/font.yaml +65 -0
- data/gems/mime-types-data-3.2021.0225/types/image.yaml +1251 -0
- data/gems/mime-types-data-3.2021.0225/types/message.yaml +200 -0
- data/gems/mime-types-data-3.2021.0225/types/model.yaml +331 -0
- data/gems/mime-types-data-3.2021.0225/types/multipart.yaml +179 -0
- data/gems/mime-types-data-3.2021.0225/types/text.yaml +1145 -0
- data/gems/mime-types-data-3.2021.0225/types/video.yaml +1094 -0
- data/gems/mime-types-data-3.2021.0225/types/world.yaml +8 -0
- data/kinetic_sdk.gemspec +3 -3
- data/lib/kinetic_sdk.rb +2 -2
- data/lib/kinetic_sdk/core/lib/teams.rb +12 -0
- data/lib/kinetic_sdk/core/lib/users.rb +12 -1
- data/lib/kinetic_sdk/utils/kinetic-http.rb +2 -4
- data/lib/kinetic_sdk/version.rb +1 -1
- metadata +72 -59
- data/gems/mime-types-3.1/History.rdoc +0 -658
- data/gems/mime-types-3.1/lib/mime-types.rb +0 -1
- data/gems/mime-types-3.1/lib/mime/types/columnar.rb +0 -1
- data/gems/mime-types-3.1/lib/mime/types/container.rb +0 -30
- data/gems/mime-types-data-3.2016.0521/Contributing.md +0 -157
- data/gems/mime-types-data-3.2016.0521/History.md +0 -351
- data/gems/mime-types-data-3.2016.0521/README.md +0 -61
- data/gems/mime-types-data-3.2016.0521/Rakefile +0 -80
- data/gems/mime-types-data-3.2016.0521/data/mime-types.json +0 -1
@@ -4,6 +4,7 @@ home :: https://github.com/mime-types/ruby-mime-types/
|
|
4
4
|
code :: https://github.com/mime-types/ruby-mime-types/
|
5
5
|
bugs :: https://github.com/mime-types/ruby-mime-types/issues
|
6
6
|
rdoc :: http://rdoc.info/gems/mime-types/
|
7
|
+
clog :: https://github.com/mime-types/ruby-mime-types/blob/master/History.md
|
7
8
|
continuous integration :: {<img src="https://travis-ci.org/mime-types/ruby-mime-types.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/mime-types/ruby-mime-types]
|
8
9
|
test coverage :: {<img src="https://coveralls.io/repos/mime-types/ruby-mime-types/badge.svg?branch=master&service=github" alt="Coverage Status" />}[https://coveralls.io/github/mime-types/ruby-mime-types?branch=master]
|
9
10
|
|
@@ -35,16 +36,6 @@ recommendations, the {IANA Media Types
|
|
35
36
|
registry}[https://www.iana.org/assignments/media-types/media-types.xhtml], and
|
36
37
|
user contributions. It conforms to RFCs 2045 and 2231.
|
37
38
|
|
38
|
-
=== mime-types 1.x End of Life
|
39
|
-
|
40
|
-
mime-types 1.x is no longer supported as of 2015-10-27.
|
41
|
-
|
42
|
-
=== mime-types 2.x End of Life
|
43
|
-
|
44
|
-
mime-types 2.x is supported as 2.99.x receiving quarterly updates of the IANA
|
45
|
-
registry and security updates for two years. It will reach full end of life on
|
46
|
-
2017-11-21.
|
47
|
-
|
48
39
|
=== mime-types 3.x
|
49
40
|
|
50
41
|
Users are encouraged to upgrade to mime-types 3.x as soon as is practical.
|
@@ -183,7 +174,7 @@ MAJOR.MINOR:
|
|
183
174
|
incremented, MINOR will be set to zero, and PATCH will be reset to the
|
184
175
|
implied zero.
|
185
176
|
|
186
|
-
2. If an API (code) feature is added that does not break
|
177
|
+
2. If an API (code) feature is added that does not break compatibility, the
|
187
178
|
MINOR version will be incremented and PATCH will be reset to the implied zero.
|
188
179
|
|
189
180
|
3. If there is a bugfix to a feature added in the most recent MAJOR.MINOR
|
@@ -195,8 +186,8 @@ features because of the existence of the [mime-types-data][] gem, and if
|
|
195
186
|
features are marked deprecated in the course of mime-types 3.x, they will not
|
196
187
|
be removed until mime-types 4.x or possibly later.
|
197
188
|
|
198
|
-
|
189
|
+
{Code of Conduct}[Code-of-Conduct_md.html]
|
199
190
|
|
200
|
-
|
191
|
+
{Contributing}[Contributing_md.html]
|
201
192
|
|
202
|
-
|
193
|
+
{Licence}[Licence_md.html]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'hoe'
|
@@ -17,7 +17,7 @@ spec = Hoe.spec 'mime-types' do
|
|
17
17
|
|
18
18
|
require_ruby_version '>= 2.0'
|
19
19
|
|
20
|
-
self.history_file = 'History.
|
20
|
+
self.history_file = 'History.md'
|
21
21
|
self.readme_file = 'README.rdoc'
|
22
22
|
|
23
23
|
license 'MIT'
|
@@ -32,10 +32,10 @@ spec = Hoe.spec 'mime-types' do
|
|
32
32
|
extra_dev_deps << ['minitest', '~> 5.4']
|
33
33
|
extra_dev_deps << ['minitest-autotest', '~> 1.0']
|
34
34
|
extra_dev_deps << ['minitest-focus', '~> 1.0']
|
35
|
-
extra_dev_deps << ['minitest-bonus-assertions', '~>
|
35
|
+
extra_dev_deps << ['minitest-bonus-assertions', '~> 3.0']
|
36
36
|
extra_dev_deps << ['minitest-hooks', '~> 1.4']
|
37
|
-
extra_dev_deps << ['rake', '
|
38
|
-
extra_dev_deps << ['fivemat', '~> 1.3'
|
37
|
+
extra_dev_deps << ['rake', '>= 10.0', '< 13.0']
|
38
|
+
extra_dev_deps << ['fivemat', '~> 1.3']
|
39
39
|
extra_dev_deps << ['minitest-rg', '~> 5.2']
|
40
40
|
|
41
41
|
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.0')
|
@@ -54,7 +54,7 @@ namespace :benchmark do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
desc 'Benchmark Load Times'
|
57
|
-
task :load, [
|
57
|
+
task :load, [:repeats] => 'benchmark:support' do |_, args|
|
58
58
|
require 'benchmarks/load'
|
59
59
|
Benchmarks::Load.report(
|
60
60
|
File.join(Rake.application.original_dir, 'lib'),
|
@@ -63,7 +63,7 @@ namespace :benchmark do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
desc 'Allocation counts'
|
66
|
-
task :allocations, [
|
66
|
+
task :allocations, [:top_x, :mime_types_only] => 'benchmark:support' do |_, args|
|
67
67
|
require 'benchmarks/load_allocations'
|
68
68
|
Benchmarks::LoadAllocations.report(
|
69
69
|
top_x: args.top_x,
|
@@ -72,7 +72,7 @@ namespace :benchmark do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
desc 'Columnar allocation counts'
|
75
|
-
task 'allocations:columnar', [
|
75
|
+
task 'allocations:columnar', [:top_x, :mime_types_only] => 'benchmark:support' do |_, args|
|
76
76
|
require 'benchmarks/load_allocations'
|
77
77
|
Benchmarks::LoadAllocations.report(
|
78
78
|
columnar: true,
|
@@ -82,7 +82,7 @@ namespace :benchmark do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
desc 'Columnar allocation counts (full load)'
|
85
|
-
task 'allocations:columnar:full', [
|
85
|
+
task 'allocations:columnar:full', [:top_x, :mime_types_only] => 'benchmark:support' do |_, args|
|
86
86
|
require 'benchmarks/load_allocations'
|
87
87
|
Benchmarks::LoadAllocations.report(
|
88
88
|
columnar: true,
|
@@ -92,6 +92,36 @@ namespace :benchmark do
|
|
92
92
|
)
|
93
93
|
end
|
94
94
|
|
95
|
+
desc 'Memory profiler'
|
96
|
+
task :memory, [:top_x, :mime_types_only] => 'benchmark:support' do |_, args|
|
97
|
+
require 'benchmarks/memory_profiler'
|
98
|
+
Benchmarks::ProfileMemory.report(
|
99
|
+
mime_types_only: args.mime_types_only,
|
100
|
+
top_x: args.top_x
|
101
|
+
)
|
102
|
+
end
|
103
|
+
|
104
|
+
desc 'Columnar memory profiler'
|
105
|
+
task 'memory:columnar', [:top_x, :mime_types_only] => 'benchmark:support' do |_, args|
|
106
|
+
require 'benchmarks/memory_profiler'
|
107
|
+
Benchmarks::ProfileMemory.report(
|
108
|
+
columnar: true,
|
109
|
+
mime_types_only: args.mime_types_only,
|
110
|
+
top_x: args.top_x
|
111
|
+
)
|
112
|
+
end
|
113
|
+
|
114
|
+
desc 'Columnar allocation counts (full load)'
|
115
|
+
task 'memory:columnar:full', [:top_x, :mime_types_only] => 'benchmark:support' do |_, args|
|
116
|
+
require 'benchmarks/memory_profiler'
|
117
|
+
Benchmarks::ProfileMemory.report(
|
118
|
+
columnar: true,
|
119
|
+
full: true,
|
120
|
+
top_x: args.top_x,
|
121
|
+
mime_types_only: args.mime_types_only
|
122
|
+
)
|
123
|
+
end
|
124
|
+
|
95
125
|
desc 'Object counts'
|
96
126
|
task objects: 'benchmark:support' do
|
97
127
|
require 'benchmarks/object_counts'
|
@@ -129,7 +159,7 @@ namespace :profile do
|
|
129
159
|
'-R', 'mime/types',
|
130
160
|
'-s', 'self',
|
131
161
|
'-p', 'multi',
|
132
|
-
'-f',
|
162
|
+
'-f', output.to_s,
|
133
163
|
script.to_s
|
134
164
|
]
|
135
165
|
ruby args.join(' ')
|
@@ -192,7 +222,7 @@ namespace :convert do
|
|
192
222
|
rdoc = name
|
193
223
|
mark = "#{File.basename(name, '.rdoc')}.md"
|
194
224
|
|
195
|
-
file mark => [
|
225
|
+
file mark => [rdoc, :setup] do |t|
|
196
226
|
puts "#{rdoc} => #{mark}"
|
197
227
|
File.open(t.name, 'wb') { |target|
|
198
228
|
target.write @doc_converter.convert(IO.read(t.prerequisites.first))
|
@@ -201,7 +231,7 @@ namespace :convert do
|
|
201
231
|
|
202
232
|
CLEAN.add mark
|
203
233
|
|
204
|
-
task run: [
|
234
|
+
task run: [mark]
|
205
235
|
end
|
206
236
|
end
|
207
237
|
|
@@ -209,7 +239,7 @@ namespace :convert do
|
|
209
239
|
task docs: 'convert:docs:run'
|
210
240
|
end
|
211
241
|
|
212
|
-
task 'deps:top', [
|
242
|
+
task 'deps:top', [:number] do |_, args|
|
213
243
|
require 'net/http'
|
214
244
|
require 'json'
|
215
245
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
##
|
2
4
|
module MIME
|
3
5
|
end
|
@@ -55,21 +57,21 @@ class MIME::Type
|
|
55
57
|
end
|
56
58
|
|
57
59
|
# The released version of the mime-types library.
|
58
|
-
VERSION = '3.1'
|
60
|
+
VERSION = '3.3.1'
|
59
61
|
|
60
62
|
include Comparable
|
61
63
|
|
62
64
|
# :stopdoc:
|
63
65
|
# TODO verify mime-type character restrictions; I am pretty sure that this is
|
64
66
|
# too wide open.
|
65
|
-
MEDIA_TYPE_RE = %r{([-\w.+]+)/([-\w.+]*)}
|
66
|
-
I18N_RE =
|
67
|
-
BINARY_ENCODINGS = %w(base64 8bit)
|
68
|
-
ASCII_ENCODINGS = %w(7bit quoted-printable)
|
67
|
+
MEDIA_TYPE_RE = %r{([-\w.+]+)/([-\w.+]*)}.freeze
|
68
|
+
I18N_RE = /[^[:alnum:]]/.freeze
|
69
|
+
BINARY_ENCODINGS = %w(base64 8bit).freeze
|
70
|
+
ASCII_ENCODINGS = %w(7bit quoted-printable).freeze
|
69
71
|
# :startdoc:
|
70
72
|
|
71
73
|
private_constant :MEDIA_TYPE_RE, :I18N_RE, :BINARY_ENCODINGS,
|
72
|
-
|
74
|
+
:ASCII_ENCODINGS
|
73
75
|
|
74
76
|
# Builds a MIME::Type object from the +content_type+, a MIME Content Type
|
75
77
|
# value (e.g., 'text/plain' or 'applicaton/x-eruby'). The constructed object
|
@@ -129,7 +131,11 @@ class MIME::Type
|
|
129
131
|
elsif other.respond_to?(:simplified)
|
130
132
|
simplified <=> other.simplified
|
131
133
|
else
|
132
|
-
|
134
|
+
filtered = 'silent' if other == :silent
|
135
|
+
filtered ||= 'true' if other == true
|
136
|
+
filtered ||= other.to_s
|
137
|
+
|
138
|
+
simplified <=> MIME::Type.simplified(filtered)
|
133
139
|
end
|
134
140
|
end
|
135
141
|
|
@@ -151,7 +157,7 @@ class MIME::Type
|
|
151
157
|
# before unregistered or obsolete content types.
|
152
158
|
def priority_compare(other)
|
153
159
|
pc = simplified <=> other.simplified
|
154
|
-
if pc.zero?
|
160
|
+
if pc.zero? || !(extensions & other.extensions).empty?
|
155
161
|
pc = if (reg = registered?) != other.registered?
|
156
162
|
reg ? -1 : 1 # registered < unregistered
|
157
163
|
elsif (comp = complete?) != other.complete?
|
@@ -295,7 +301,7 @@ class MIME::Type
|
|
295
301
|
|
296
302
|
# Returns the default encoding for the MIME::Type based on the media type.
|
297
303
|
def default_encoding
|
298
|
-
|
304
|
+
@media_type == 'text' ? 'quoted-printable' : 'base64'
|
299
305
|
end
|
300
306
|
|
301
307
|
##
|
@@ -315,7 +321,7 @@ class MIME::Type
|
|
315
321
|
|
316
322
|
# Returns +true+ if the media type is obsolete.
|
317
323
|
attr_accessor :obsolete
|
318
|
-
|
324
|
+
alias obsolete? obsolete
|
319
325
|
|
320
326
|
# The documentation for this MIME::Type.
|
321
327
|
attr_accessor :docs
|
@@ -325,7 +331,7 @@ class MIME::Type
|
|
325
331
|
# call-seq:
|
326
332
|
# text_plain.friendly # => "Text File"
|
327
333
|
# text_plain.friendly('en') # => "Text File"
|
328
|
-
def friendly(lang = 'en'
|
334
|
+
def friendly(lang = 'en')
|
329
335
|
@friendly ||= {}
|
330
336
|
|
331
337
|
case lang
|
@@ -337,7 +343,7 @@ class MIME::Type
|
|
337
343
|
@friendly.update(lang)
|
338
344
|
else
|
339
345
|
fail ArgumentError,
|
340
|
-
|
346
|
+
"Expected a language or translation set, not #{lang.inspect}"
|
341
347
|
end
|
342
348
|
end
|
343
349
|
|
@@ -361,14 +367,8 @@ class MIME::Type
|
|
361
367
|
attr_reader :xrefs
|
362
368
|
|
363
369
|
##
|
364
|
-
def xrefs=(
|
365
|
-
MIME::Types::Container.new
|
366
|
-
xr.each do |k, v|
|
367
|
-
xr[k] = Set[*v] unless v.kind_of? Set
|
368
|
-
end
|
369
|
-
|
370
|
-
@xrefs = xr
|
371
|
-
end
|
370
|
+
def xrefs=(xrefs) # :nodoc:
|
371
|
+
@xrefs = MIME::Types::Container.new(xrefs)
|
372
372
|
end
|
373
373
|
|
374
374
|
# The decoded cross-reference URL list for this MIME::Type.
|
@@ -381,7 +381,7 @@ class MIME::Type
|
|
381
381
|
|
382
382
|
# Indicates whether the MIME type has been registered with IANA.
|
383
383
|
attr_accessor :registered
|
384
|
-
|
384
|
+
alias registered? registered
|
385
385
|
|
386
386
|
# MIME types can be specified to be sent across a network in particular
|
387
387
|
# formats. This method returns +true+ when the MIME::Type encoding is set
|
@@ -399,7 +399,7 @@ class MIME::Type
|
|
399
399
|
|
400
400
|
# Indicateswhether the MIME type is declared as a signature type.
|
401
401
|
attr_accessor :signature
|
402
|
-
|
402
|
+
alias signature? signature
|
403
403
|
|
404
404
|
# Returns +true+ if the MIME::Type specifies an extension list,
|
405
405
|
# indicating that it is a complete MIME::Type.
|
@@ -438,28 +438,26 @@ class MIME::Type
|
|
438
438
|
#
|
439
439
|
# This method should be considered a private implementation detail.
|
440
440
|
def encode_with(coder)
|
441
|
-
coder['content-type']
|
442
|
-
coder['docs']
|
443
|
-
unless @friendly.nil? or @friendly.empty?
|
444
|
-
|
445
|
-
|
446
|
-
coder['encoding'] = @encoding
|
447
|
-
coder['extensions'] = @extensions.to_a unless @extensions.empty?
|
441
|
+
coder['content-type'] = @content_type
|
442
|
+
coder['docs'] = @docs unless @docs.nil? or @docs.empty?
|
443
|
+
coder['friendly'] = @friendly unless @friendly.nil? or @friendly.empty?
|
444
|
+
coder['encoding'] = @encoding
|
445
|
+
coder['extensions'] = @extensions.to_a unless @extensions.empty?
|
448
446
|
coder['preferred-extension'] = @preferred_extension if @preferred_extension
|
449
447
|
if obsolete?
|
450
|
-
coder['obsolete']
|
451
|
-
coder['use-instead']
|
448
|
+
coder['obsolete'] = obsolete?
|
449
|
+
coder['use-instead'] = use_instead if use_instead
|
452
450
|
end
|
453
451
|
unless xrefs.empty?
|
454
452
|
{}.tap do |hash|
|
455
453
|
xrefs.each do |k, v|
|
456
|
-
hash[k] = v.sort
|
454
|
+
hash[k] = v.to_a.sort
|
457
455
|
end
|
458
456
|
coder['xrefs'] = hash
|
459
457
|
end
|
460
458
|
end
|
461
|
-
coder['registered']
|
462
|
-
coder['signature']
|
459
|
+
coder['registered'] = registered?
|
460
|
+
coder['signature'] = signature? if signature?
|
463
461
|
coder
|
464
462
|
end
|
465
463
|
|
@@ -504,7 +502,7 @@ class MIME::Type
|
|
504
502
|
# use with the I18n library.
|
505
503
|
def i18n_key(content_type)
|
506
504
|
simplify_matchdata(match(content_type), joiner: '.') { |e|
|
507
|
-
e.gsub!(I18N_RE, '-'
|
505
|
+
e.gsub!(I18N_RE, '-')
|
508
506
|
}
|
509
507
|
end
|
510
508
|
|
@@ -521,12 +519,12 @@ class MIME::Type
|
|
521
519
|
|
522
520
|
private
|
523
521
|
|
524
|
-
def simplify_matchdata(matchdata, remove_x = false, joiner: '/'
|
522
|
+
def simplify_matchdata(matchdata, remove_x = false, joiner: '/')
|
525
523
|
return nil unless matchdata
|
526
524
|
|
527
525
|
matchdata.captures.map { |e|
|
528
526
|
e.downcase!
|
529
|
-
e.sub!(
|
527
|
+
e.sub!(/^x-/, '') if remove_x
|
530
528
|
yield e if block_given?
|
531
529
|
e
|
532
530
|
}.join(joiner)
|
@@ -539,11 +537,28 @@ class MIME::Type
|
|
539
537
|
match = MEDIA_TYPE_RE.match(type_string)
|
540
538
|
fail InvalidContentType, type_string if match.nil?
|
541
539
|
|
542
|
-
@content_type = type_string
|
540
|
+
@content_type = intern_string(type_string)
|
543
541
|
@raw_media_type, @raw_sub_type = match.captures
|
544
|
-
@simplified = MIME::Type.simplified(match)
|
545
|
-
@i18n_key = MIME::Type.i18n_key(match)
|
542
|
+
@simplified = intern_string(MIME::Type.simplified(match))
|
543
|
+
@i18n_key = intern_string(MIME::Type.i18n_key(match))
|
546
544
|
@media_type, @sub_type = MEDIA_TYPE_RE.match(@simplified).captures
|
545
|
+
|
546
|
+
@raw_media_type = intern_string(@raw_media_type)
|
547
|
+
@raw_sub_type = intern_string(@raw_sub_type)
|
548
|
+
@media_type = intern_string(@media_type)
|
549
|
+
@sub_type = intern_string(@sub_type)
|
550
|
+
end
|
551
|
+
|
552
|
+
if String.method_defined?(:-@)
|
553
|
+
def intern_string(string)
|
554
|
+
-string
|
555
|
+
end
|
556
|
+
else
|
557
|
+
# MRI 2.2 and older don't have a method for string interning,
|
558
|
+
# so we simply freeze them for keeping a similar interface
|
559
|
+
def intern_string(string)
|
560
|
+
string.freeze
|
561
|
+
end
|
547
562
|
end
|
548
563
|
|
549
564
|
def xref_map(values, helper)
|
@@ -551,23 +566,22 @@ class MIME::Type
|
|
551
566
|
end
|
552
567
|
|
553
568
|
def xref_url_for_rfc(value)
|
554
|
-
'http://www.iana.org/go/%s'
|
569
|
+
'http://www.iana.org/go/%s' % value
|
555
570
|
end
|
556
571
|
|
557
572
|
def xref_url_for_draft(value)
|
558
|
-
'http://www.iana.org/go/%s'
|
573
|
+
'http://www.iana.org/go/%s' % value.sub(/\ARFC/, 'draft')
|
559
574
|
end
|
560
575
|
|
561
576
|
def xref_url_for_rfc_errata(value)
|
562
|
-
'http://www.rfc-editor.org/errata_search.php?eid=%s'
|
577
|
+
'http://www.rfc-editor.org/errata_search.php?eid=%s' % value
|
563
578
|
end
|
564
579
|
|
565
580
|
def xref_url_for_person(value)
|
566
|
-
'http://www.iana.org/assignments/media-types/media-types.xhtml#%s'
|
567
|
-
value
|
581
|
+
'http://www.iana.org/assignments/media-types/media-types.xhtml#%s' % value
|
568
582
|
end
|
569
583
|
|
570
584
|
def xref_url_for_template(value)
|
571
|
-
'http://www.iana.org/assignments/media-types/%s'
|
585
|
+
'http://www.iana.org/assignments/media-types/%s' % value
|
572
586
|
end
|
573
587
|
end
|