kinetic_sdk 5.0.18 → 5.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -1
  3. data/gems/{mime-types-3.1/Code-of-Conduct.rdoc → mime-types-3.3.1/Code-of-Conduct.md} +19 -20
  4. data/gems/{mime-types-3.1/Contributing.rdoc → mime-types-3.3.1/Contributing.md} +67 -54
  5. data/gems/mime-types-3.3.1/History.md +240 -0
  6. data/gems/{mime-types-data-3.2016.0521 → mime-types-3.3.1}/Licence.md +1 -1
  7. data/gems/{mime-types-3.1 → mime-types-3.3.1}/Manifest.txt +4 -4
  8. data/gems/{mime-types-3.1 → mime-types-3.3.1}/README.rdoc +5 -14
  9. data/gems/{mime-types-3.1 → mime-types-3.3.1}/Rakefile +43 -13
  10. data/gems/mime-types-3.3.1/lib/mime-types.rb +3 -0
  11. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/type.rb +60 -46
  12. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/type/columnar.rb +4 -2
  13. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types.rb +11 -8
  14. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/_columnar.rb +10 -9
  15. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/cache.rb +7 -5
  16. data/gems/mime-types-3.3.1/lib/mime/types/columnar.rb +3 -0
  17. data/gems/mime-types-3.3.1/lib/mime/types/container.rb +96 -0
  18. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/deprecations.rb +3 -3
  19. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/full.rb +2 -0
  20. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/loader.rb +2 -4
  21. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/logger.rb +3 -1
  22. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/registry.rb +12 -3
  23. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/bad-fixtures/malformed +0 -0
  24. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/fixture/json.json +0 -0
  25. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/fixture/old-data +0 -0
  26. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/fixture/yaml.yaml +0 -0
  27. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/minitest_helper.rb +1 -1
  28. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_type.rb +33 -26
  29. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_types.rb +33 -25
  30. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_types_cache.rb +15 -6
  31. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_types_class.rb +18 -14
  32. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_types_lazy.rb +10 -4
  33. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_types_loader.rb +1 -1
  34. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/Code-of-Conduct.md +10 -10
  35. data/gems/mime-types-data-3.2021.0225/Contributing.md +224 -0
  36. data/gems/mime-types-data-3.2021.0225/History.md +468 -0
  37. data/gems/{mime-types-3.1/Licence.rdoc → mime-types-data-3.2021.0225/Licence.md} +3 -3
  38. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/Manifest.txt +13 -0
  39. data/gems/mime-types-data-3.2021.0225/README.md +63 -0
  40. data/gems/mime-types-data-3.2021.0225/Rakefile +159 -0
  41. data/gems/mime-types-data-3.2021.0225/data/mime-types.json +1 -0
  42. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.content_type.column +364 -13
  43. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.docs.column +351 -0
  44. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.encoding.column +351 -0
  45. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.flags.column +352 -1
  46. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.friendly.column +351 -0
  47. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.pext.column +351 -0
  48. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.use_instead.column +351 -0
  49. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.xrefs.column +480 -129
  50. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/lib/mime-types-data.rb +0 -0
  51. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/lib/mime/types/data.rb +1 -1
  52. data/gems/mime-types-data-3.2021.0225/types/application.yaml +16933 -0
  53. data/gems/mime-types-data-3.2021.0225/types/audio.yaml +1714 -0
  54. data/gems/mime-types-data-3.2021.0225/types/chemical.yaml +71 -0
  55. data/gems/mime-types-data-3.2021.0225/types/conference.yaml +9 -0
  56. data/gems/mime-types-data-3.2021.0225/types/drawing.yaml +15 -0
  57. data/gems/mime-types-data-3.2021.0225/types/font.yaml +65 -0
  58. data/gems/mime-types-data-3.2021.0225/types/image.yaml +1251 -0
  59. data/gems/mime-types-data-3.2021.0225/types/message.yaml +200 -0
  60. data/gems/mime-types-data-3.2021.0225/types/model.yaml +331 -0
  61. data/gems/mime-types-data-3.2021.0225/types/multipart.yaml +179 -0
  62. data/gems/mime-types-data-3.2021.0225/types/text.yaml +1145 -0
  63. data/gems/mime-types-data-3.2021.0225/types/video.yaml +1094 -0
  64. data/gems/mime-types-data-3.2021.0225/types/world.yaml +8 -0
  65. data/kinetic_sdk.gemspec +3 -3
  66. data/lib/kinetic_sdk.rb +2 -2
  67. data/lib/kinetic_sdk/version.rb +1 -1
  68. metadata +86 -73
  69. data/gems/mime-types-3.1/History.rdoc +0 -658
  70. data/gems/mime-types-3.1/lib/mime-types.rb +0 -1
  71. data/gems/mime-types-3.1/lib/mime/types/columnar.rb +0 -1
  72. data/gems/mime-types-3.1/lib/mime/types/container.rb +0 -30
  73. data/gems/mime-types-data-3.2016.0521/Contributing.md +0 -157
  74. data/gems/mime-types-data-3.2016.0521/History.md +0 -351
  75. data/gems/mime-types-data-3.2016.0521/README.md +0 -61
  76. data/gems/mime-types-data-3.2016.0521/Rakefile +0 -80
  77. data/gems/mime-types-data-3.2016.0521/data/mime-types.json +0 -1
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mime/type'
2
4
 
3
5
  # A version of MIME::Type that works hand-in-hand with a MIME::Types::Columnar
@@ -18,7 +20,7 @@ class MIME::Type::Columnar < MIME::Type
18
20
  end
19
21
 
20
22
  def self.column(*methods, file: nil) # :nodoc:
21
- file = methods.first unless file
23
+ file ||= methods.first
22
24
 
23
25
  file_method = :"load_#{file}"
24
26
  methods.each do |m|
@@ -34,7 +36,7 @@ class MIME::Type::Columnar < MIME::Type
34
36
  column :docs, :docs=
35
37
  column :preferred_extension, :preferred_extension=
36
38
  column :obsolete, :obsolete=, :obsolete?, :registered, :registered=,
37
- :registered?, :signature, :signature=, :signature?, file: 'flags'
39
+ :registered?, :signature, :signature=, :signature?, file: 'flags'
38
40
  column :xrefs, :xrefs=, :xref_urls
39
41
  column :use_instead, :use_instead=
40
42
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ##
2
4
  module MIME
3
5
  ##
@@ -149,11 +151,11 @@ class MIME::Types
149
151
  def type_for(filename)
150
152
  Array(filename).flat_map { |fn|
151
153
  @extension_index[fn.chomp.downcase[/\.?([^.]*?)$/, 1]]
152
- }.compact.inject(:+).sort { |a, b|
154
+ }.compact.inject(Set.new, :+).sort { |a, b|
153
155
  a.priority_compare(b)
154
156
  }
155
157
  end
156
- alias_method :of, :type_for
158
+ alias of type_for
157
159
 
158
160
  # Add one or more MIME::Type objects to the set of known types. If the
159
161
  # type is already known, a warning will be displayed.
@@ -169,7 +171,7 @@ class MIME::Types
169
171
  nil
170
172
  when MIME::Types
171
173
  variants = mime_type.instance_variable_get(:@type_variants)
172
- add(*variants.values.inject(:+).to_a, quiet)
174
+ add(*variants.values.inject(Set.new, :+).to_a, quiet)
173
175
  when Array
174
176
  add(*mime_type, quiet)
175
177
  else
@@ -183,9 +185,9 @@ class MIME::Types
183
185
  # truthy value to suppress that warning.
184
186
  def add_type(type, quiet = false)
185
187
  if !quiet and @type_variants[type.simplified].include?(type)
186
- MIME::Types.logger.warn <<-warning
188
+ MIME::Types.logger.warn <<-WARNING
187
189
  Type #{type} is already registered as a variant of #{type.simplified}.
188
- warning
190
+ WARNING
189
191
  end
190
192
 
191
193
  add_type_variant!(type)
@@ -195,16 +197,17 @@ Type #{type} is already registered as a variant of #{type.simplified}.
195
197
  private
196
198
 
197
199
  def add_type_variant!(mime_type)
198
- @type_variants[mime_type.simplified] << mime_type
200
+ @type_variants.add(mime_type.simplified, mime_type)
199
201
  end
200
202
 
201
203
  def reindex_extensions!(mime_type)
202
204
  return unless @type_variants[mime_type.simplified].include?(mime_type)
205
+
203
206
  index_extensions!(mime_type)
204
207
  end
205
208
 
206
209
  def index_extensions!(mime_type)
207
- mime_type.extensions.each { |ext| @extension_index[ext] << mime_type }
210
+ mime_type.extensions.each { |ext| @extension_index.add(ext, mime_type) }
208
211
  end
209
212
 
210
213
  def prune_matches(matches, complete, registered)
@@ -216,7 +219,7 @@ Type #{type} is already registered as a variant of #{type.simplified}.
216
219
  def match(pattern)
217
220
  @type_variants.select { |k, _|
218
221
  k =~ pattern
219
- }.values.inject(:+)
222
+ }.values.inject(Set.new, :+)
220
223
  end
221
224
  end
222
225
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mime/type/columnar'
2
4
 
3
5
  # MIME::Types::Columnar is used to extend a MIME::Types container to load data
@@ -43,7 +45,7 @@ module MIME::Types::Columnar
43
45
  i = -1
44
46
  column = File.join(@__root__, "mime.#{name}.column")
45
47
 
46
- IO.readlines(column, encoding: 'UTF-8'.freeze).each do |line|
48
+ IO.readlines(column, encoding: 'UTF-8').each do |line|
47
49
  line.chomp!
48
50
 
49
51
  if lookup
@@ -61,7 +63,6 @@ module MIME::Types::Columnar
61
63
  def load_encoding
62
64
  each_file_line('encoding') do |type, line|
63
65
  pool ||= {}
64
- line.freeze
65
66
  type.instance_variable_set(:@encoding, (pool[line] ||= line))
66
67
  end
67
68
  end
@@ -106,11 +107,11 @@ module MIME::Types::Columnar
106
107
  end
107
108
 
108
109
  def dict(line, array: false)
109
- if line == '-'.freeze
110
+ if line == '-'
110
111
  {}
111
112
  else
112
- line.split('|'.freeze).each_with_object({}) { |l, h|
113
- k, v = l.split('^'.freeze)
113
+ line.split('|').each_with_object({}) { |l, h|
114
+ k, v = l.split('^')
114
115
  v = nil if v.empty?
115
116
  h[k] = array ? Array(v) : v
116
117
  }
@@ -118,18 +119,18 @@ module MIME::Types::Columnar
118
119
  end
119
120
 
120
121
  def arr(line)
121
- if line == '-'.freeze
122
+ if line == '-'
122
123
  []
123
124
  else
124
- line.split('|'.freeze).flatten.compact.uniq
125
+ line.split('|').flatten.compact.uniq
125
126
  end
126
127
  end
127
128
 
128
129
  def opt(line)
129
- line unless line == '-'.freeze
130
+ line unless line == '-'
130
131
  end
131
132
 
132
133
  def flag(line)
133
- line == '1'.freeze ? true : false
134
+ line == '1'
134
135
  end
135
136
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  MIME::Types::Cache = Struct.new(:version, :data) # :nodoc:
2
4
 
3
5
  # Caching of MIME::Types registries is advisable if you will be loading
@@ -20,16 +22,16 @@ class << MIME::Types::Cache
20
22
  if cache.version == MIME::Types::Data::VERSION
21
23
  Marshal.load(cache.data)
22
24
  else
23
- MIME::Types.logger.warn <<-warning.chomp
25
+ MIME::Types.logger.warn <<-WARNING.chomp
24
26
  Could not load MIME::Types cache: invalid version
25
- warning
27
+ WARNING
26
28
  nil
27
29
  end
28
30
  rescue => e
29
- MIME::Types.logger.warn <<-warning.chomp
31
+ MIME::Types.logger.warn <<-WARNING.chomp
30
32
  Could not load MIME::Types cache: #{e}
31
- warning
32
- return nil
33
+ WARNING
34
+ nil
33
35
  end
34
36
 
35
37
  # Attempts to save the types provided to the cache file provided.
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mime/types'
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'set'
4
+ require 'forwardable'
5
+
6
+ # MIME::Types requires a serializable keyed container that returns an empty Set
7
+ # on a key miss. Hash#default_value cannot be used because, while it traverses
8
+ # the Marshal format correctly, it won't survive any other serialization
9
+ # format (plus, a default of a mutable object resuls in a shared mess).
10
+ # Hash#default_proc cannot be used without a wrapper because it prevents
11
+ # Marshal serialization (and doesn't survive the round-trip).
12
+ class MIME::Types::Container #:nodoc:
13
+ extend Forwardable
14
+
15
+ def initialize(hash = {})
16
+ @container = {}
17
+ merge!(hash)
18
+ end
19
+
20
+ def [](key)
21
+ container[key] || EMPTY_SET
22
+ end
23
+
24
+ def []=(key, value)
25
+ container[key] =
26
+ case value
27
+ when Set
28
+ value
29
+ else
30
+ Set[*value]
31
+ end
32
+ end
33
+
34
+ def merge(other)
35
+ self.class.new(other)
36
+ end
37
+
38
+ def merge!(other)
39
+ tap {
40
+ other = other.kind_of?(MIME::Types::Container) ? other.container : other
41
+ container.merge!(other)
42
+ normalize
43
+ }
44
+ end
45
+
46
+ def to_hash
47
+ container
48
+ end
49
+
50
+ def_delegators :@container,
51
+ :==,
52
+ :count,
53
+ :each,
54
+ :each_value,
55
+ :empty?,
56
+ :flat_map,
57
+ :keys,
58
+ :select,
59
+ :values
60
+
61
+ def add(key, value)
62
+ (container[key] ||= Set.new).add(value)
63
+ end
64
+
65
+ def marshal_dump
66
+ {}.merge(container)
67
+ end
68
+
69
+ def marshal_load(hash)
70
+ @container = hash
71
+ end
72
+
73
+ def encode_with(coder)
74
+ container.each { |k, v| coder[k] = v.to_a }
75
+ end
76
+
77
+ def init_with(coder)
78
+ @container = {}
79
+ coder.map.each { |k, v| container[k] = Set[*v] }
80
+ end
81
+
82
+ protected
83
+
84
+ attr_accessor :container
85
+
86
+ def normalize
87
+ container.each do |k, v|
88
+ next if v.kind_of?(Set)
89
+
90
+ container[k] = Set[*v]
91
+ end
92
+ end
93
+
94
+ EMPTY_SET = Set.new.freeze
95
+ private_constant :EMPTY_SET
96
+ end
@@ -1,4 +1,4 @@
1
- # -*- ruby encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'mime/types/logger'
4
4
 
@@ -23,9 +23,9 @@ module MIME
23
23
  else
24
24
  message
25
25
  end
26
- MIME::Types.logger.warn <<-warning.chomp
26
+ MIME::Types.logger.warn <<-WARNING.chomp
27
27
  #{caller[1]}: #{klass}#{level}#{sym} is deprecated #{message}.
28
- warning
28
+ WARNING
29
29
  block.call if block
30
30
  end
31
31
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ##
2
4
  module MIME
3
5
  ##
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # -*- ruby encoding: utf-8 -*-
2
4
 
3
5
  ##
@@ -31,10 +33,6 @@ class MIME::Types::Loader
31
33
  path = path || ENV['RUBY_MIME_TYPES_DATA'] || MIME::Types::Data::PATH
32
34
  @container = container || MIME::Types.new
33
35
  @path = File.expand_path(path)
34
- # begin
35
- # require 'mime/lazy_types'
36
- # @container.extend(MIME::LazyTypes)
37
- # end
38
36
  end
39
37
 
40
38
  # Loads a MIME::Types registry from YAML files (<tt>*.yml</tt> or
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # -*- ruby encoding: utf-8 -*-
2
4
 
3
5
  require 'logger'
@@ -25,7 +27,7 @@ module MIME
25
27
  end
26
28
  end
27
29
 
28
- def initialize(_1, _2 = nil, _3 = nil)
30
+ def initialize(_one, _two = nil, _three = nil)
29
31
  super nil
30
32
  @logdev = WarnLogDevice.new
31
33
  @formatter = ->(_s, _d, _p, m) { m }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class << MIME::Types
2
4
  include Enumerable
3
5
 
@@ -31,7 +33,7 @@ class << MIME::Types
31
33
  def type_for(filename)
32
34
  __types__.type_for(filename)
33
35
  end
34
- alias_method :of, :type_for
36
+ alias of type_for
35
37
 
36
38
  # MIME::Types#add against the default MIME::Types registry.
37
39
  def add(*types)
@@ -41,6 +43,12 @@ class << MIME::Types
41
43
  private
42
44
 
43
45
  def lazy_load?
46
+ return unless ENV.key?('RUBY_MIME_TYPES_LAZY_LOAD')
47
+
48
+ MIME::Types.logger.warn <<-WARNING.chomp
49
+ Lazy loading ($RUBY_MIME_TYPES_LAZY_LOAD) is deprecated and will be removed.
50
+ WARNING
51
+
44
52
  (lazy = ENV['RUBY_MIME_TYPES_LAZY_LOAD']) && (lazy != 'false')
45
53
  end
46
54
 
@@ -55,8 +63,9 @@ class << MIME::Types
55
63
  end
56
64
 
57
65
  def load_default_mime_types(mode = load_mode)
58
- @__types__ = MIME::Types::Cache.load
59
- unless @__types__
66
+ if (@__types__ = MIME::Types::Cache.load)
67
+ __instances__.add(@__types__)
68
+ else
60
69
  @__types__ = MIME::Types::Loader.load(mode)
61
70
  MIME::Types::Cache.save(@__types__)
62
71
  end
@@ -1,4 +1,4 @@
1
- # -*- ruby encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'mime/type'
4
4
  require 'fileutils'
@@ -1,11 +1,9 @@
1
- # -*- ruby encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'mime/types'
4
4
  require 'minitest_helper'
5
5
 
6
6
  describe MIME::Type do
7
- # it { fail }
8
-
9
7
  def mime_type(content_type)
10
8
  MIME::Type.new(content_type) { |mt| yield mt if block_given? }
11
9
  end
@@ -48,15 +46,15 @@ describe MIME::Type do
48
46
 
49
47
  it 'does not remove x- prefixes by default' do
50
48
  assert_equal 'application/x-msword',
51
- MIME::Type.simplified('application/x-msword')
49
+ MIME::Type.simplified('application/x-msword')
52
50
  assert_equal 'x-xyz/abc', MIME::Type.simplified('x-xyz/abc')
53
51
  end
54
52
 
55
53
  it 'removes x- prefixes when requested' do
56
54
  assert_equal 'application/msword',
57
- MIME::Type.simplified('application/x-msword', remove_x_prefix: true)
55
+ MIME::Type.simplified('application/x-msword', remove_x_prefix: true)
58
56
  assert_equal 'xyz/abc',
59
- MIME::Type.simplified('x-xyz/abc', remove_x_prefix: true)
57
+ MIME::Type.simplified('x-xyz/abc', remove_x_prefix: true)
60
58
  end
61
59
 
62
60
  it 'lowercases mixed-case types' do
@@ -75,7 +73,7 @@ describe MIME::Type do
75
73
 
76
74
  it 'does not remove x-prefixes' do
77
75
  assert_equal 'application.x-msword',
78
- MIME::Type.i18n_key('application/x-msword')
76
+ MIME::Type.i18n_key('application/x-msword')
79
77
  end
80
78
 
81
79
  it 'converts text/vCard to text.vcard' do
@@ -330,21 +328,32 @@ describe MIME::Type do
330
328
  assert_priority text_1, text_1p, text_2
331
329
  end
332
330
 
333
- it 'sorts (2) based on the registration state' do
331
+ it 'sorts (2) based on extensions' do
332
+ text_1.extensions = ['foo', 'bar']
333
+ text_2.extensions = ['foo']
334
+
335
+ assert_priority_same text_1, text_2
336
+
337
+ text_2.registered = true
338
+
339
+ assert_priority_more text_1, text_2
340
+ end
341
+
342
+ it 'sorts (3) based on the registration state' do
334
343
  text_1.registered = text_1p.registered = true
335
344
  text_1b = mime_type(text_1) { |t| t.registered = false }
336
345
 
337
346
  assert_priority text_1, text_1p, text_1b
338
347
  end
339
348
 
340
- it 'sorts (3) based on the completeness' do
349
+ it 'sorts (4) based on the completeness' do
341
350
  text_1.extensions = text_1p.extensions = '1'
342
351
  text_1b = mime_type(text_1) { |t| t.extensions = nil }
343
352
 
344
353
  assert_priority text_1, text_1p, text_1b
345
354
  end
346
355
 
347
- it 'sorts (4) based on obsolete status' do
356
+ it 'sorts (5) based on obsolete status' do
348
357
  text_1.obsolete = text_1p.obsolete = false
349
358
  text_1b = mime_type(text_1) { |t| t.obsolete = true }
350
359
 
@@ -427,12 +436,12 @@ describe MIME::Type do
427
436
 
428
437
  it 'has the extensions key if set' do
429
438
  assert_has_keys mime_type(t) { |v| v.extensions = 'a' }.to_h,
430
- 'extensions'
439
+ 'extensions'
431
440
  end
432
441
 
433
442
  it 'has the preferred-extension key if set' do
434
443
  assert_has_keys mime_type(t) { |v| v.preferred_extension = 'a' }.to_h,
435
- 'preferred-extension'
444
+ 'preferred-extension'
436
445
  end
437
446
 
438
447
  it 'has the obsolete key if set' do
@@ -463,7 +472,7 @@ describe MIME::Type do
463
472
 
464
473
  describe '#to_s, #to_str' do
465
474
  it 'represents itself as a string of the canonical content_type' do
466
- assert_equal 'text/plain', "#{text_plain}"
475
+ assert_equal 'text/plain', text_plain.to_s
467
476
  end
468
477
 
469
478
  it 'acts like a string of the canonical content_type for comparison' do
@@ -477,9 +486,7 @@ describe MIME::Type do
477
486
 
478
487
  describe '#xrefs, #xrefs=' do
479
488
  let(:expected) {
480
- {
481
- 'rfc' => Set[*%w(rfc1234 rfc5678)]
482
- }
489
+ MIME::Types::Container.new('rfc' => Set['rfc1234', 'rfc5678'])
483
490
  }
484
491
 
485
492
  it 'returns the expected results' do
@@ -507,13 +514,13 @@ describe MIME::Type do
507
514
  let(:type) {
508
515
  mime_type('a/b').tap do |t|
509
516
  t.xrefs = {
510
- 'draft' => [ 'RFC1' ],
511
- 'template' => [ 'a/b' ],
512
- 'person' => [ 'p-1' ],
513
- 'rfc' => [ 'rfc-1' ],
514
- 'rfc-errata' => [ 'err-1' ],
515
- 'uri' => [ 'http://example.org' ],
516
- 'text' => [ 'text' ]
517
+ 'draft' => ['RFC1'],
518
+ 'template' => ['a/b'],
519
+ 'person' => ['p-1'],
520
+ 'rfc' => ['rfc-1'],
521
+ 'rfc-errata' => ['err-1'],
522
+ 'uri' => ['http://example.org'],
523
+ 'text' => ['text']
517
524
  }
518
525
  end
519
526
  }
@@ -577,10 +584,10 @@ describe MIME::Type do
577
584
 
578
585
  it 'merges new values from an array parameter' do
579
586
  expected = { 'en' => 'Text files' }
580
- assert_equal expected, text_plain.friendly([ 'en', 'Text files' ])
587
+ assert_equal expected, text_plain.friendly(['en', 'Text files'])
581
588
  expected.update('fr' => 'des fichiers texte')
582
589
  assert_equal expected,
583
- text_plain.friendly([ 'fr', 'des fichiers texte' ])
590
+ text_plain.friendly(['fr', 'des fichiers texte'])
584
591
  end
585
592
 
586
593
  it 'merges new values from a hash parameter' do
@@ -597,7 +604,7 @@ describe MIME::Type do
597
604
  end
598
605
 
599
606
  assert_equal 'Expected a language or translation set, not 1',
600
- exception.message
607
+ exception.message
601
608
  end
602
609
  end
603
610
  end