hash_validator 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +6 -5
- data/hash_validator.gemspec +1 -1
- data/lib/hash_validator/validators/optional_validator.rb +1 -1
- data/lib/hash_validator/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e9643ea0272321ae3212a9c811044f18fcbf3a2
|
4
|
+
data.tar.gz: eedaa6b41b8e3c812fa9cc49c9282d7ac59cac07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 603d75b24833ba30bc6b9a8a6b730fd90b88ca00515c1cdaa157290b42424c801c7fc4fd84ea8ce8f992fb44ddbcdf4d8004399c5c193c48b899b89fbb55acbb
|
7
|
+
data.tar.gz: 52e365ac0b3e587c38519634db61e84737bf75526836f56aadbf7a9a2b7430adda18851de718a00bc4c31509ab3ae63c8cb803cef0674ff0c77f41dddb20d554
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# Hash Validator
|
2
2
|
|
3
|
-
[![Gem
|
4
|
-
[![
|
5
|
-
[![
|
6
|
-
[![Code Climate](https://
|
7
|
-
[![
|
3
|
+
[![Gem](https://img.shields.io/gem/v/hash_validator.svg)]()
|
4
|
+
[![Travis](https://travis-ci.org/jamesbrooks/hash_validator.svg)](https://travis-ci.org/jamesbrooks/hash_validator)
|
5
|
+
[![Coveralls](https://img.shields.io/coveralls/jamesbrooks/hash_validator.svg)](https://coveralls.io/r/jamesbrooks/hash_validator)
|
6
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/JamesBrooks/hash_validator.svg)](https://codeclimate.com/github/JamesBrooks/hash_validator)
|
7
|
+
[![Gemnasium](https://img.shields.io/gemnasium/jamesbrooks/hash_validator.svg)](https://gemnasium.com/github.com/JamesBrooks/hash_validator)
|
8
8
|
|
9
9
|
Ruby library to validate hashes (Hash) against user-defined requirements
|
10
10
|
|
@@ -84,6 +84,7 @@ Additional validations exist to validate beyond simple typing, such as:
|
|
84
84
|
|
85
85
|
* An Enumerable instance: validates that the value is contained within the supplied enumerable.
|
86
86
|
* A lambda/Proc instance: validates that the lambda/proc returns true when the value is supplied (lambdas must accept only one argument).
|
87
|
+
* A regexp instance: validates that the regex returns a match when the value is supplied (Regexp#match(value) is not nil).
|
87
88
|
* `email`: email address validation (string + email address).
|
88
89
|
|
89
90
|
Example use-cases include Ruby APIs (I'm currently using it in a Rails API that I'm building for better error responses to developers).
|
data/hash_validator.gemspec
CHANGED
@@ -20,6 +20,6 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
22
|
spec.add_development_dependency 'rake'
|
23
|
-
spec.add_development_dependency 'rspec', '~>
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3.5.0'
|
24
24
|
spec.add_development_dependency 'coveralls'
|
25
25
|
end
|
@@ -10,7 +10,7 @@ module HashValidator
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def validate(key, value, validations, errors)
|
13
|
-
|
13
|
+
unless value.nil?
|
14
14
|
::HashValidator.validator_for(validations.validation).validate(key, value, validations.validation, errors)
|
15
15
|
errors.delete(key) if errors[key].respond_to?(:empty?) && errors[key].empty?
|
16
16
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hash_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Brooks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 3.5.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 3.5.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: coveralls
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.5.
|
138
|
+
rubygems_version: 2.5.2
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Ruby library to validate hashes (Hash) against user-defined requirements
|