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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 765d257c1c164253fc920091c417c0b23315ddee7e4d1be7cf2b53d0afa31e53
4
- data.tar.gz: 9cdb4da632bdacc45fdeec2b0532e9b747f0b92f60646cf3f2779af52f6520a8
3
+ metadata.gz: c82ce878dd9f8c140109bc24d6348022b17799df55f936a057f6280e2b6f0b7f
4
+ data.tar.gz: 45e5d79a196db1e7040401b3c954cbd677c32f5f07569795e7d9c3f5dc57e22f
5
5
  SHA512:
6
- metadata.gz: 8397c4a34805f88648398cf4a2e9787255b803413f88e13c37d4d2aa81d99df5b4b9c5544bb5b6f938d7d5afc51515d891d232f5a4d300af8b858856f91449f1
7
- data.tar.gz: 273c364371d31a1810e29446786c46326b1385438a58cad2448ec61ecf170564f71e2b34da9e7467b0bd01ea98d837cda73d330408df39292cdf6072b0916f72
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?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LicenseValidator
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: license-validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brands Insurance