classy_hash 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/classy_hash.rb +5 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb81cef4f4d479a0268add5597b92dd9cc2c38ed
4
- data.tar.gz: 476532b9fc8e6bb077d095e911cd529e9fdc9bc0
3
+ metadata.gz: db4eaffcfdfc4473eac0c0015e1b88467a05dfd7
4
+ data.tar.gz: 7d8d571929c4083e87d0c13634da1b291b30066e
5
5
  SHA512:
6
- metadata.gz: d747ebfcf3c9a615b6dcf40959857f2fbbe56b55d6ae8902da98dda0cfd187d706a4fa7b6db4fe549dce8bfe3e84a18e6a99ff1940e48a35757b11a3e76c9cfa
7
- data.tar.gz: a65a0978bc15a704acc880711163acf5b4132c094e5bd1e44b237278ab350f265efe3be529021de68f1c04a82c4a7fa2eb88d418fd97ed7f111691418327b415
6
+ metadata.gz: ae8d8af71f0f1d85b7273c6033202052c43d5fe8f7701390e8639172cd7a701e43249e9a539beea3e516659b11e50df3cd787acc2649cf2844c9c00c454edf16
7
+ data.tar.gz: 6160ecd7f1fe24d247d3b65da2191d4449a612fa250e670af00cca30dca881e90a485ba9aad4e28d45f334341f73d1434558eb00ffeda542b56aa9852efd25c2
@@ -70,16 +70,18 @@ module ClassyHash
70
70
  end
71
71
  end
72
72
 
73
- self.raise_error(parent_path, key, "one of #{multiconstraint_string(constraints)}")
73
+ self.raise_error(parent_path, key, "one of #{multiconstraint_string(constraints, value)}")
74
74
  end
75
75
 
76
76
  # Generates a semi-compact String describing the given +constraints+.
77
- def self.multiconstraint_string(constraints)
77
+ def self.multiconstraint_string(constraints, value)
78
78
  constraints.map{|c|
79
79
  if c.is_a?(Hash)
80
80
  "{...schema...}"
81
81
  elsif c.is_a?(Array)
82
- "[#{self.multiconstraint_string(c)}]"
82
+ "[#{self.multiconstraint_string(c, value)}]"
83
+ elsif c.is_a?(Proc)
84
+ c.call(value) || c.inspect
83
85
  elsif c == :optional
84
86
  nil
85
87
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: classy_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deseret Book
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-26 00:00:00.000000000 Z
12
+ date: 2015-10-01 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: |2
15
15
  Classy Hash is a schema validator for Ruby Hashes. You provide a simple