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.
- checksums.yaml +4 -4
- data/lib/classy_hash.rb +5 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db4eaffcfdfc4473eac0c0015e1b88467a05dfd7
|
4
|
+
data.tar.gz: 7d8d571929c4083e87d0c13634da1b291b30066e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae8d8af71f0f1d85b7273c6033202052c43d5fe8f7701390e8639172cd7a701e43249e9a539beea3e516659b11e50df3cd787acc2649cf2844c9c00c454edf16
|
7
|
+
data.tar.gz: 6160ecd7f1fe24d247d3b65da2191d4449a612fa250e670af00cca30dca881e90a485ba9aad4e28d45f334341f73d1434558eb00ffeda542b56aa9852efd25c2
|
data/lib/classy_hash.rb
CHANGED
@@ -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
|
+
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-
|
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
|