validator_fn 0.2.8 → 0.3.8
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/version.rb +1 -1
- data/lib/validator_fn.rb +2 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ea7512cdc3b010b687c5cf9d2fec7d79f6724c56547e31ced2903762e81e9b3
|
4
|
+
data.tar.gz: 5e45c2d9df2ff27104da89d0a97f19788a3de304b4575a3a317fa567620a6692
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e683c7186d468ac169210bab0a8033601b7873051381ee14f24dc1760d30f9dd8731723b303b8090464081afea842f8db309c8f5fc2d0666a54500efb31fd22d
|
7
|
+
data.tar.gz: f172ff2aa6e4b1f243ae50000da20f8a6cd86c385f872cbe0c2cea6f222e2c1b025ead98c1af6191637467646e1c11c42628bb9205546dc5a5ac8042b3f3b6ee
|
data/Gemfile.lock
CHANGED
data/lib/validator_fn/version.rb
CHANGED
data/lib/validator_fn.rb
CHANGED
@@ -40,17 +40,10 @@ module ValidatorFn
|
|
40
40
|
@@hash_of = ->fields, hash {
|
41
41
|
hash ||= {}
|
42
42
|
fields.reduce({}) do |memo, (key, fn)|
|
43
|
-
|
44
|
-
if value == :missing_field
|
45
|
-
raise MissingKey.new(key)
|
46
|
-
else
|
47
|
-
memo[key] = fn.(hash[key]) if hash[key]
|
48
|
-
end
|
43
|
+
memo[key] = fn.(hash[key])
|
49
44
|
memo
|
50
|
-
rescue MissingKey => e
|
51
|
-
raise
|
52
45
|
rescue Error => e
|
53
|
-
invalid.("Invalid value for #{key.inspect} key
|
46
|
+
invalid.("Invalid value for #{key.inspect} key:")
|
54
47
|
end
|
55
48
|
}.curry
|
56
49
|
|