license-validator 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/license_validator/validations/base.rb +19 -0
- data/lib/license_validator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c82ce878dd9f8c140109bc24d6348022b17799df55f936a057f6280e2b6f0b7f
|
4
|
+
data.tar.gz: 45e5d79a196db1e7040401b3c954cbd677c32f5f07569795e7d9c3f5dc57e22f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3709c38143d205668041dd552db487501c8736caa55f68eaa61e9c854487181848ab7b0c0c0934ee82897cebb1668541a3a81f7e47cc86028ef9de675f81633a
|
7
|
+
data.tar.gz: 47754170b0cfe18e6357e072411c2425b305cfca8f82bdfc41b63c21a1e280148ece3053d0d4b892be5597041c80605043c1682582a038c5b442953e8b39db11
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module LicenseValidator
|
4
4
|
module Validations
|
5
5
|
class Base
|
6
|
+
extend ActiveModel::Naming
|
7
|
+
|
6
8
|
# @return [LicenseValidator::Driver]
|
7
9
|
attr_accessor :driver
|
8
10
|
# @return [ActiveModel::Errors]
|
@@ -12,6 +14,18 @@ module LicenseValidator
|
|
12
14
|
# @return [ActiveModel::Errors]
|
13
15
|
attr_accessor :warnings
|
14
16
|
|
17
|
+
class << self
|
18
|
+
# Necessary for ActiveModel::Errors https://api.rubyonrails.org/classes/ActiveModel/Errors.html
|
19
|
+
def lookup_ancestors
|
20
|
+
[self]
|
21
|
+
end
|
22
|
+
|
23
|
+
# Necessary for ActiveModel::Errors https://api.rubyonrails.org/classes/ActiveModel/Errors.html
|
24
|
+
def human_attribute_name(attr, _options = {})
|
25
|
+
attr
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
15
29
|
# @param driver [LicenseValidator::Driver]
|
16
30
|
def initialize(driver)
|
17
31
|
@errors = ActiveModel::Errors.new(self)
|
@@ -21,6 +35,11 @@ module LicenseValidator
|
|
21
35
|
@driver = driver
|
22
36
|
end
|
23
37
|
|
38
|
+
# Necessary for ActiveModel::Errors https://api.rubyonrails.org/classes/ActiveModel/Errors.html
|
39
|
+
def read_attribute_for_validation(attr)
|
40
|
+
__send__(attr)
|
41
|
+
end
|
42
|
+
|
24
43
|
# Common validations
|
25
44
|
def validate
|
26
45
|
return if driver.dob.nil?
|