validator_fn 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/validator_fn.rb +4 -3
- data/lib/validator_fn/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: 4a79bc916ca1dba284aa215464f30a5734be7384e74153e704e57cade0bd4856
|
4
|
+
data.tar.gz: 1e4ae24e5abd2cff941117b3558fe39fe9c0c2efdf1ef13f87806dc07902e341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abb3834b1c0f4a93770ec973f39fd65f44f1e63bc7cf30beeadbf69e6fa3bddbb48ca13d77f33ca76426bd1d7b4fe60253c680d038c01680b399871dd7fdf8db
|
7
|
+
data.tar.gz: fe879dc647418bbd36a31784e740b08a52e4ed63774b9e5e1c40b785cd303e69dfd0c94e921c47f37ccc9466f61b51f3dde7ee5c01696eef4ddcdaec7a94d0af
|
data/Gemfile.lock
CHANGED
data/lib/validator_fn.rb
CHANGED
@@ -62,11 +62,12 @@ module ValidatorFn
|
|
62
62
|
@@is_a = ->klass, a { invalid.("Expected type #{klass}, got #{a.inspect}") unless a.is_a?(klass); a }.curry
|
63
63
|
@@hash_of = ->fields, hash {
|
64
64
|
hash ||= {}
|
65
|
-
fields.
|
66
|
-
[key
|
65
|
+
fields.reduce({}) do |memo, (key, fn)|
|
66
|
+
memo[key] ||= fn.(hash[key]) if hash[key]
|
67
|
+
memo
|
67
68
|
rescue Error => e
|
68
69
|
invalid.("Invalid value for #{key.inspect} key.")
|
69
|
-
end
|
70
|
+
end
|
70
71
|
}.curry
|
71
72
|
|
72
73
|
@@handle_error = ->on_error, validator, value {
|
data/lib/validator_fn/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validator_fn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Chabot
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fn_reader
|