dh-proteus 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/proteus/validators/validation_dsl.rb +9 -0
- data/lib/proteus/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a77dbb027e5fa908a882bdd0e3e5d076067b082b45a6cde9ac2c7d64af37797
|
4
|
+
data.tar.gz: fb454e7a4f5325272ae61bc53a39d0e195dcac7e65f1f821744f296c70660fe3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1e131bf8c9842ce2245449fbdc5b37a673dd4224dbcbf9ed9d649f81ed2f7b4708a5976ee6ad78243b58ce13d56e0d53fde5cd8ee95d00a265c541f089bef91
|
7
|
+
data.tar.gz: fb006ba80ba9626ec9c83d1d1f7eb53bc2de21d3f1b1b9750ab9d1146cff8be6c4295b15f8d5fd7385cad405899791253cb075243713b6ff1ea78a9bc3acae08
|
@@ -82,6 +82,15 @@ module Proteus
|
|
82
82
|
raise ValidationError.new(message_suffix: "Data in hierarchy #{keys_to_hierarchy(*@key_stack)} invalid. Value of #{current_data[key.to_s]} must match #{options[:matches].inspect}.")
|
83
83
|
end
|
84
84
|
end
|
85
|
+
|
86
|
+
if options.key?(:length)
|
87
|
+
min = options[:length][:min] || 0
|
88
|
+
max = options[:length][:max] || 18446744073709551616 # 2**64
|
89
|
+
|
90
|
+
unless current_data[key.to_s].size >= min && current_data[key.to_s].size <= max
|
91
|
+
raise ValidationError.new(message_suffix: "Data in hierarchy #{keys_to_hierarchy(*@key_stack)} invalid. Length of #{current_data[key.to_s]} must be in range [#{min}, #{max}].")
|
92
|
+
end
|
93
|
+
end
|
85
94
|
end
|
86
95
|
else
|
87
96
|
unless options.key?(:optional)
|
data/lib/proteus/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dh-proteus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Albrecht
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|