media_types 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +12 -12
- data/lib/media_types/scheme.rb +0 -4
- data/lib/media_types/scheme/enumeration_of_type.rb +6 -2
- data/lib/media_types/scheme/rules.rb +1 -1
- data/lib/media_types/scheme/validation_options.rb +4 -0
- data/lib/media_types/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b854726c0783d1e7f27c66a195362a9df615500fb0bc329a935aa589d3451138
|
4
|
+
data.tar.gz: 3699e6ea389a304a2a7970911a39ae269e0705b3283c8b816868f1ba76abc6fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05a9e6bb7d2cf222148750830b4efb69fc73a7b955e4a7cf51de6dbe3ed4866187cc498c7b11c8060f0a3dc53eac76fa7bc762049ed6174bdaccc0ea3fa118c7
|
7
|
+
data.tar.gz: c811c45d8ed2355a39f49f924d09a6a3326abe715e86b5ce4634d6a7dc1d2a18c565e6f1f6de60a769aa2fd6a863bd328da82a15ee3a8e6eaded39beab35856d
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
media_types (0.6.
|
4
|
+
media_types (0.6.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
actionpack (5.2.
|
10
|
-
actionview (= 5.2.
|
11
|
-
activesupport (= 5.2.
|
9
|
+
actionpack (5.2.3)
|
10
|
+
actionview (= 5.2.3)
|
11
|
+
activesupport (= 5.2.3)
|
12
12
|
rack (~> 2.0)
|
13
13
|
rack-test (>= 0.6.3)
|
14
14
|
rails-dom-testing (~> 2.0)
|
15
15
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
16
|
-
actionview (5.2.
|
17
|
-
activesupport (= 5.2.
|
16
|
+
actionview (5.2.3)
|
17
|
+
activesupport (= 5.2.3)
|
18
18
|
builder (~> 3.1)
|
19
19
|
erubi (~> 1.4)
|
20
20
|
rails-dom-testing (~> 2.0)
|
21
21
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
22
|
-
activesupport (5.2.
|
22
|
+
activesupport (5.2.3)
|
23
23
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
24
24
|
i18n (>= 0.7, < 2)
|
25
25
|
minitest (~> 5.1)
|
@@ -29,13 +29,13 @@ GEM
|
|
29
29
|
ansi (1.5.0)
|
30
30
|
awesome_print (1.8.0)
|
31
31
|
builder (3.2.3)
|
32
|
-
concurrent-ruby (1.1.
|
32
|
+
concurrent-ruby (1.1.5)
|
33
33
|
crass (1.0.4)
|
34
34
|
docile (1.3.1)
|
35
35
|
domain_name (0.5.20180417)
|
36
36
|
unf (>= 0.0.5, < 1.0.0)
|
37
37
|
erubi (1.8.0)
|
38
|
-
http (4.
|
38
|
+
http (4.1.1)
|
39
39
|
addressable (~> 2.3)
|
40
40
|
http-cookie (~> 1.0)
|
41
41
|
http-form_data (~> 2.0)
|
@@ -59,11 +59,11 @@ GEM
|
|
59
59
|
builder
|
60
60
|
minitest (>= 5.0)
|
61
61
|
ruby-progressbar
|
62
|
-
nokogiri (1.10.
|
62
|
+
nokogiri (1.10.3)
|
63
63
|
mini_portile2 (~> 2.4.0)
|
64
|
-
nokogiri (1.10.
|
64
|
+
nokogiri (1.10.3-x64-mingw32)
|
65
65
|
mini_portile2 (~> 2.4.0)
|
66
|
-
oj (3.7.
|
66
|
+
oj (3.7.12)
|
67
67
|
public_suffix (3.0.3)
|
68
68
|
rack (2.0.6)
|
69
69
|
rack-test (1.1.0)
|
data/lib/media_types/scheme.rb
CHANGED
@@ -290,10 +290,6 @@ module MediaTypes
|
|
290
290
|
#
|
291
291
|
def collection(key, scheme = nil, allow_empty: false, expected_type: ::Array, optional: false, &block)
|
292
292
|
unless block_given?
|
293
|
-
if scheme.is_a?(Scheme)
|
294
|
-
return rules.add(key, scheme, optional: optional)
|
295
|
-
end
|
296
|
-
|
297
293
|
return rules.add(
|
298
294
|
key,
|
299
295
|
EnumerationOfType.new(
|
@@ -59,12 +59,16 @@ module MediaTypes
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def validate_items!(output, options)
|
62
|
-
output.all? do |item|
|
62
|
+
output.each_with_index.all? do |item, index|
|
63
63
|
next true if item_type === item # rubocop:disable Style/CaseEquality
|
64
|
+
if item_type.is_a?(Scheme)
|
65
|
+
item_type.validate(item, options.trace("[#{index}]"))
|
66
|
+
next true
|
67
|
+
end
|
64
68
|
raise ValidationError,
|
65
69
|
format(
|
66
70
|
'Expected collection item as %<type>s, got %<actual>s at [%<backtrace>s]',
|
67
|
-
type: item_type,
|
71
|
+
type: item_type.inspect,
|
68
72
|
actual: item.inspect,
|
69
73
|
backtrace: options.backtrace.join('->')
|
70
74
|
)
|
@@ -91,7 +91,7 @@ module MediaTypes
|
|
91
91
|
return "#{prefix}[Error]Depth limit reached[/Error]" if indent > 5_000
|
92
92
|
|
93
93
|
[
|
94
|
-
"#{prefix}[Rules n=#{keys.length} optional=#{optional_keys.length}]",
|
94
|
+
"#{prefix}[Rules n=#{keys.length} optional=#{optional_keys.length} allow_empty=#{allow_empty?}]",
|
95
95
|
"#{prefix} #{inspect_format_attribute(indent, '*', default)}",
|
96
96
|
*keys.map { |key| "#{prefix} #{inspect_format_attribute(indent, key)}" },
|
97
97
|
"#{prefix}[/Rules]"
|
@@ -11,6 +11,10 @@ module MediaTypes
|
|
11
11
|
self.backtrace = backtrace
|
12
12
|
end
|
13
13
|
|
14
|
+
def inspect
|
15
|
+
"backtrack: #{backtrace.inspect}, strict: #{strict.inspect}, exhaustive: #{exhaustive}"
|
16
|
+
end
|
17
|
+
|
14
18
|
def with_backtrace(backtrace)
|
15
19
|
ValidationOptions.new(exhaustive: exhaustive, strict: strict, backtrace: backtrace)
|
16
20
|
end
|
data/lib/media_types/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: media_types
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derk-Jan Karrenbeld
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -219,8 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
219
|
- !ruby/object:Gem::Version
|
220
220
|
version: '0'
|
221
221
|
requirements: []
|
222
|
-
|
223
|
-
rubygems_version: 2.7.6
|
222
|
+
rubygems_version: 3.0.3
|
224
223
|
signing_key:
|
225
224
|
specification_version: 4
|
226
225
|
summary: Library to create media type definitions, schemes and validations
|