classy_hash 0.1.3 → 0.1.4

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 +6 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c312e543d1f629c815c7b1c15358a169b3420ea6
4
- data.tar.gz: 2bdd15d37771bea764e2f2582dcdc37d16ee2dfe
3
+ metadata.gz: eb81cef4f4d479a0268add5597b92dd9cc2c38ed
4
+ data.tar.gz: 476532b9fc8e6bb077d095e911cd529e9fdc9bc0
5
5
  SHA512:
6
- metadata.gz: be3b7e32372be07cf3efaa7163002d2a85af1059a0ed6523bbfe619e7770e4eb80fb0f2c2b2254a069cde84643f25ccf56cea389f7325ce2bd1f9411c62bfde8
7
- data.tar.gz: bb3287e9a7838a57b42ff90b3fe0fc535f9765c3c25df20b8369ff11529971b7a2602a87f640f9176daf27f7f9c47cc5eee71b879ad3444b08681d77ab99bc52
6
+ metadata.gz: d747ebfcf3c9a615b6dcf40959857f2fbbe56b55d6ae8902da98dda0cfd187d706a4fa7b6db4fe549dce8bfe3e84a18e6a99ff1940e48a35757b11a3e76c9cfa
7
+ data.tar.gz: a65a0978bc15a704acc880711163acf5b4132c094e5bd1e44b237278ab350f265efe3be529021de68f1c04a82c4a7fa2eb88d418fd97ed7f111691418327b415
@@ -121,6 +121,12 @@ module ClassyHash
121
121
  self.check_multi(key, value, constraint, parent_path)
122
122
  end
123
123
 
124
+ when Regexp
125
+ # Constrain value to be a String matching a Regexp
126
+ unless value.is_a?(String) && value =~ constraint
127
+ self.raise_error(parent_path, key, "a String matching #{constraint.inspect}")
128
+ end
129
+
124
130
  when Proc
125
131
  # User-specified validator
126
132
  result = constraint.call(value)
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.3
4
+ version: 0.1.4
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: 2014-10-16 00:00:00.000000000 Z
12
+ date: 2015-05-26 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