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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59d88acda61662b4adc0cf17e6abe58ccab42be28b84291191504ed2545e8d5a
4
- data.tar.gz: 0c7485fe2f3208a490ad0e4220f00e5770cad7ecb1a1798f5cae98d7bde40a0e
3
+ metadata.gz: 4a79bc916ca1dba284aa215464f30a5734be7384e74153e704e57cade0bd4856
4
+ data.tar.gz: 1e4ae24e5abd2cff941117b3558fe39fe9c0c2efdf1ef13f87806dc07902e341
5
5
  SHA512:
6
- metadata.gz: cea6572a3db872f38516950d3b763b67a81bd1d10dd576624662b84e9203a99e80c9fdaba10b21f6e77d56ba079d261f27d2a5a454bb825dc26b0f64be6664fa
7
- data.tar.gz: f4917cd8611691a44dc56b49fa2c36b350c30edced673ac71a4aa6b41f412ffb0e538a22d2edcc98ba02522cb2c9aabb2624fa68b43898ee0ca3b22f52113e00
6
+ metadata.gz: abb3834b1c0f4a93770ec973f39fd65f44f1e63bc7cf30beeadbf69e6fa3bddbb48ca13d77f33ca76426bd1d7b4fe60253c680d038c01680b399871dd7fdf8db
7
+ data.tar.gz: fe879dc647418bbd36a31784e740b08a52e4ed63774b9e5e1c40b785cd303e69dfd0c94e921c47f37ccc9466f61b51f3dde7ee5c01696eef4ddcdaec7a94d0af
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- validator_fn (0.1.2)
4
+ validator_fn (0.1.3)
5
5
  fn_reader
6
6
 
7
7
  GEM
@@ -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.map do |(key, fn)|
66
- [key, fn.(hash[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.to_h
70
+ end
70
71
  }.curry
71
72
 
72
73
  @@handle_error = ->on_error, validator, value {
@@ -1,3 +1,3 @@
1
1
  module ValidatorFn
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
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-26 00:00:00.000000000 Z
11
+ date: 2020-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fn_reader