vindicate 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/vindicate.rb +0 -1
- data/lib/vindicate/version.rb +1 -1
- data/lib/vindicate/vin_validator.rb +6 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27ab1baa3d580ba8e7faf8f1022e75089f4ffb2f3f005cf6e9a5b0a8f1eb5c95
|
4
|
+
data.tar.gz: 248a6b94f6f6875048724f85aac370506333e546ac7b837bfb4750a2c989dc8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf2c553959f003349bcb22c4eb94456e0c1e277deeb17254b88c548ec77c366b2c3ffe3001aea6980f617b274de3d54fec264b77d6417d5f997f58971f0397eb
|
7
|
+
data.tar.gz: a408d40f75e10c8e41c713e4ebb508d99176eb0cd07f7318833e54960a829b137ccf7ec0b0f2bd4511a73fa6d30f7aa41f1d1c7fd96d970874cf311a39421f23
|
data/lib/vindicate.rb
CHANGED
data/lib/vindicate/version.rb
CHANGED
@@ -2,7 +2,11 @@ class VinValidator < ActiveModel::EachValidator
|
|
2
2
|
VALID_CHARS = /[A-HJ-NPR-Z0-9]{17}/i
|
3
3
|
|
4
4
|
def validate_each(record, attribute, value)
|
5
|
-
return if value.
|
5
|
+
return if value.blank?
|
6
|
+
unless value.respond_to?(:length)
|
7
|
+
record.errors[attribute] << 'is invalid'
|
8
|
+
return
|
9
|
+
end
|
6
10
|
if value.length < 17
|
7
11
|
record.errors[attribute] << 'is too short'
|
8
12
|
return
|
@@ -37,4 +41,4 @@ class VinValidator < ActiveModel::EachValidator
|
|
37
41
|
calculate_check_digit(vin) == vin[8]
|
38
42
|
end
|
39
43
|
|
40
|
-
end
|
44
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vindicate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- stevensona
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
|
-
rubygems_version: 3.0.
|
101
|
+
rubygems_version: 3.0.3
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: VIN Number validator for ActiveModel
|