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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a362dbc4c478fd0fbd56ddd22f7690efcc128842b227d8311d3567d1f11b9f58
4
- data.tar.gz: fdfdcb1d320206535340ac2005f33a4570380168f351e17b873f9a6ba135da72
3
+ metadata.gz: 0a77dbb027e5fa908a882bdd0e3e5d076067b082b45a6cde9ac2c7d64af37797
4
+ data.tar.gz: fb454e7a4f5325272ae61bc53a39d0e195dcac7e65f1f821744f296c70660fe3
5
5
  SHA512:
6
- metadata.gz: 4a528d740696ca119d25c5ad5dcccc0fd76f083700be8af86d744e749426db128b122499033f7c0f6541b0a419b700948d7641eb3146dd6abb6708ca30abb320
7
- data.tar.gz: 0aab32af3a501781cf8a3a34250b911b34003513c02a62976252b2842dac95f904fe7f59aa3342b28a36e35dc538fa5841d4d277194cbcf267c3eb26144d6ae9
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)
@@ -1,5 +1,5 @@
1
1
  module Proteus
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
4
4
 
5
5
  if $0 == __FILE__
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.1
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-18 00:00:00.000000000 Z
11
+ date: 2019-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler