vindetta 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/lib/vindetta/cli.rb +1 -1
- data/lib/vindetta/validator.rb +13 -3
- data/lib/vindetta/version.rb +1 -1
- data/lib/vindetta/vin.rb +1 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2396851ea95b9d4316fdfd6264415f569cd4031
|
4
|
+
data.tar.gz: e2fafae216be76b8ff1fef39dc7d2efbfbc969f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2cce9e236fff4b20f2a0ff138d53769acc842b2ac735b112f8fe7b91f925892f72f3287c747ae92916c0d22adcf21f5972db70106c3ab8887b70c88cd71474c
|
7
|
+
data.tar.gz: ff995b0a3646ccbedc48e4c37edf824e89e1389a47ac86fafae169003f0a9ad70738d67356abd5b0608195d91352e1744def5aceda85d88c298b7be4880105f9
|
data/Gemfile
CHANGED
data/lib/vindetta/cli.rb
CHANGED
data/lib/vindetta/validator.rb
CHANGED
@@ -1,7 +1,17 @@
|
|
1
|
+
require 'active_model'
|
2
|
+
|
1
3
|
module Vindetta
|
2
|
-
class Validator
|
3
|
-
|
4
|
-
|
4
|
+
class Validator < ActiveModel::Validator
|
5
|
+
LENGTH = 17
|
6
|
+
|
7
|
+
def self.run(value)
|
8
|
+
Vin.new(value).valid?
|
9
|
+
end
|
10
|
+
|
11
|
+
def validate(record)
|
12
|
+
if record.value.length != LENGTH
|
13
|
+
record.errors.add(:value, "Invalid Length") # TODO: Move to I18n
|
14
|
+
end
|
5
15
|
end
|
6
16
|
end
|
7
17
|
end
|
data/lib/vindetta/version.rb
CHANGED
data/lib/vindetta/vin.rb
CHANGED