license-validator 0.0.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/lib/license-validator.rb +112 -0
  3. data/lib/license_validator/driver.rb +69 -0
  4. data/lib/license_validator/states.rb +14 -0
  5. data/lib/license_validator/validations/base.rb +63 -0
  6. data/lib/license_validator/validations/state_ak.rb +24 -0
  7. data/lib/license_validator/validations/state_al.rb +28 -0
  8. data/lib/license_validator/validations/state_ar.rb +20 -0
  9. data/lib/license_validator/validations/state_az.rb +32 -0
  10. data/lib/license_validator/validations/state_ca.rb +20 -0
  11. data/lib/license_validator/validations/state_co.rb +24 -0
  12. data/lib/license_validator/validations/state_ct.rb +41 -0
  13. data/lib/license_validator/validations/state_dc.rb +24 -0
  14. data/lib/license_validator/validations/state_de.rb +16 -0
  15. data/lib/license_validator/validations/state_fl.rb +16 -0
  16. data/lib/license_validator/validations/state_ga.rb +28 -0
  17. data/lib/license_validator/validations/state_hi.rb +28 -0
  18. data/lib/license_validator/validations/state_ia.rb +23 -0
  19. data/lib/license_validator/validations/state_id.rb +28 -0
  20. data/lib/license_validator/validations/state_il.rb +16 -0
  21. data/lib/license_validator/validations/state_in.rb +16 -0
  22. data/lib/license_validator/validations/state_ks.rb +26 -0
  23. data/lib/license_validator/validations/state_ky.rb +20 -0
  24. data/lib/license_validator/validations/state_la.rb +16 -0
  25. data/lib/license_validator/validations/state_ma.rb +23 -0
  26. data/lib/license_validator/validations/state_md.rb +23 -0
  27. data/lib/license_validator/validations/state_me.rb +16 -0
  28. data/lib/license_validator/validations/state_mi.rb +16 -0
  29. data/lib/license_validator/validations/state_mn.rb +16 -0
  30. data/lib/license_validator/validations/state_mo.rb +32 -0
  31. data/lib/license_validator/validations/state_ms.rb +16 -0
  32. data/lib/license_validator/validations/state_mt.rb +42 -0
  33. data/lib/license_validator/validations/state_nc.rb +24 -0
  34. data/lib/license_validator/validations/state_nd.rb +20 -0
  35. data/lib/license_validator/validations/state_ne.rb +16 -0
  36. data/lib/license_validator/validations/state_nh.rb +31 -0
  37. data/lib/license_validator/validations/state_nj.rb +16 -0
  38. data/lib/license_validator/validations/state_nm.rb +16 -0
  39. data/lib/license_validator/validations/state_nv.rb +21 -0
  40. data/lib/license_validator/validations/state_ny.rb +32 -0
  41. data/lib/license_validator/validations/state_oh.rb +20 -0
  42. data/lib/license_validator/validations/state_ok.rb +20 -0
  43. data/lib/license_validator/validations/state_or.rb +26 -0
  44. data/lib/license_validator/validations/state_pa.rb +20 -0
  45. data/lib/license_validator/validations/state_ri.rb +20 -0
  46. data/lib/license_validator/validations/state_sc.rb +16 -0
  47. data/lib/license_validator/validations/state_sd.rb +20 -0
  48. data/lib/license_validator/validations/state_tn.rb +20 -0
  49. data/lib/license_validator/validations/state_tx.rb +24 -0
  50. data/lib/license_validator/validations/state_ut.rb +16 -0
  51. data/lib/license_validator/validations/state_va.rb +16 -0
  52. data/lib/license_validator/validations/state_vt.rb +16 -0
  53. data/lib/license_validator/validations/state_wa.rb +23 -0
  54. data/lib/license_validator/validations/state_wi.rb +16 -0
  55. data/lib/license_validator/validations/state_wv.rb +27 -0
  56. data/lib/license_validator/validations/state_wy.rb +16 -0
  57. data/lib/license_validator/validators.rb +5 -0
  58. data/lib/license_validator/version.rb +1 -1
  59. metadata +85 -2
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateKs < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ if driver.dob.blank?
11
+ errors.add(:dob, 'D.O.B. is required for KS.')
12
+ end
13
+
14
+ lic_num = driver.license_num
15
+
16
+ return if lic_num.match?(/\AK\d{8}\z/i)
17
+
18
+ return if lic_num.match?(/\A[0-9a-z]{6}\z/i)
19
+
20
+ return if lic_num.match?(/\A\d{9}\z/i)
21
+
22
+ errors.add(:license_num, 'License number requires “K” and 8 Numeric, 6 Alphanumeric, or 9 numeric for KS.')
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateKy < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ lic_num = driver.license_num
11
+
12
+ return if lic_num.match?(/\A[a-z]\d{8}\z/i)
13
+
14
+ return if lic_num.match?(/\A\d{9}\z/i)
15
+
16
+ errors.add(:license_num, 'License number requires 1 alphabetic and 8 numeric, or 9 numeric for KY.')
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateLa < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ return if driver.license_num.match?(/\A\d{9}\z/i)
11
+
12
+ errors.add(:license_num, 'License number requires 9 numeric digits for LA.')
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateMa < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ lic_num = driver.license_num
11
+
12
+ return if lic_num.match?(/\A[b-z]\d{8}\z/i)
13
+
14
+ return if lic_num.match?(/\A[a-z]{2}\d{7}\z/i) && !lic_num.match?(/\Afr\d{7}\z/i)
15
+
16
+ errors.add(
17
+ :license_num,
18
+ 'License number requires 1 Alphabetic (B-Z), 8 Numeric or 2 Alphabetic (excluding FR), 7 Numeric for MA.'
19
+ )
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateMd < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ lic_num = driver.license_num
11
+
12
+ return if lic_num.match?(/\A[a-z]\d{12}\z/i)
13
+
14
+ return if lic_num.match?(/\A[a-z]{2}\d{11}\z/i)
15
+
16
+ errors.add(
17
+ :license_num,
18
+ 'License number requires 1 alphabetic and 12 numeric or 2 alphabetic and 11 numeric for MD.'
19
+ )
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateMe < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ return if driver.license_num.match?(/\A\d{7}\z/i)
11
+
12
+ errors.add(:license_num, 'License number requires 7 numeric digits for ME.')
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateMi < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ return if driver.license_num.match?(/\A[a-z]\d{12}\z/i)
11
+
12
+ errors.add(:license_num, 'License number requires 1 alphabetic and 12 numeric digits for MI.')
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateMn < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ return if driver.license_num.match?(/\A[a-z]\d{12}\z/i)
11
+
12
+ errors.add(:license_num, 'License number requires 1 alphabetic and 12 numeric digits for MN.')
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateMo < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ lic_num = driver.license_num
11
+
12
+ return if lic_num.match?(/\A\d{3}[a-z]\d{6}\z/i)
13
+
14
+ return if lic_num.match?(/\A[a-z]\d{5,9}\z/i)
15
+
16
+ return if lic_num.match?(/\A\d{9}[a-z]?\z/i)
17
+
18
+ return if lic_num.match?(/\A[a-z]\d{8}MA\z/i)
19
+
20
+ return if lic_num.match?(/\A\d{15}\z/i)
21
+
22
+ errors.add(
23
+ :license_num,
24
+ [
25
+ 'License number requires 3 numeric, 1 alphabetic, 6 numeric or 1 Alphabetic, 5-9 Numeric or 9 Numeric or',
26
+ '1 Alphabetic, 8 Numeric, 2 Alphabetic “MA” or 9 Numeric, 1 Alphabetic, or 15 Numeric for MO.'
27
+ ].join(' ')
28
+ )
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateMs < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ return if driver.license_num.match?(/\A\d{9}\z/i)
11
+
12
+ errors.add(:license_num, 'License number requires 9 numeric digits for MS.')
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateMt < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ if driver.first_name.blank?
11
+ errors.add(:first_name, 'First name required for MT.')
12
+ end
13
+
14
+ if driver.last_name.blank?
15
+ errors.add(:last_name, 'Last name required for MT.')
16
+ end
17
+
18
+ if driver.dob.blank?
19
+ errors.add(:dbo, 'D.O.B. required for MT.')
20
+ end
21
+
22
+ lic_num = driver.license_num
23
+
24
+ return if lic_num.match?(/\A[a-z]\d[0-9a-z]\d{2}[a-z]{3}\d\z/i)
25
+
26
+ return if lic_num.match?(/\A\d{13}\z/i)
27
+
28
+ return if lic_num.match?(/\A[a-z]{3}\d{10}\z/i)
29
+
30
+ return if lic_num.match?(/\A\d{9}\z/i)
31
+
32
+ errors.add(
33
+ :license_num,
34
+ [
35
+ 'License number requires 1 Alpha, 1 numeric, 1 alphanumeric, 2 numeric, 3 alpha, 1 numeric or 13 Numeric',
36
+ 'or 3 Alpha, 10 Numeric or 9 Numeric for MT.'
37
+ ].join(' ')
38
+ )
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateNc < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ unless driver.license_num.match?(/\A\d{1,12}\z/i)
11
+ errors.add(:license_num, 'License number requires 1-12 numbers for NC.')
12
+ end
13
+
14
+ if driver.last_name.blank?
15
+ errors.add(:last_name, 'Last name required for NC.')
16
+ end
17
+
18
+ return if driver.dob.present?
19
+
20
+ errors.add(:dob, 'D.O.B. required for NC.')
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateNd < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ lic_num = driver.license_num
11
+
12
+ return if lic_num.match?(/\A\d{9}\z/i)
13
+
14
+ return if lic_num.match?(/\A[a-z]{3}\d{6}\z/i)
15
+
16
+ errors.add(:license_num, 'License number reuqires 9 Numeric or 3 Alphabetic, 6 Numeric for ND.')
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateNe < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ return if driver.license_num.match?(/\A[abceghprvz]\d{8}\z/i)
11
+
12
+ errors.add(:license_num, 'License number requires 1 Alphabetic (A,B,C,E,G,H,P,R,V or Z), 8 Numeric for NE.')
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateNh < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ if driver.last_name.blank?
11
+ errors.add(:last_name, 'Last name required for NH.')
12
+ end
13
+
14
+ if driver.dob.blank?
15
+ errors.add(:dob, 'D.O.B. required for NH.')
16
+ end
17
+
18
+ lic_num = driver.license_num
19
+
20
+ return if lic_num.match?(/\A\d{2}[a-z]{3}\d{5}\z/i)
21
+
22
+ return if lic_num.match?(/\ANHL\d{8}\z/i)
23
+
24
+ errors.add(
25
+ :license_num,
26
+ 'License number requires 2 Numeric, 3 Alphabetic, 5 Numeric or “NHL”, 8 Numeric for NH.'
27
+ )
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateNj < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ return if driver.license_num.match?(/\A[a-z]\d{14}\z/i)
11
+
12
+ errors.add(:license_num, 'License number requires 1 letter and 14 numbers for NJ.')
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateNm < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ return if driver.license_num.match?(/\A\d{9}\z/i)
11
+
12
+ errors.add(:license_num, 'License number requires 9 numbers for NM.')
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateNv < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ dob_year = driver.dob.present? ? driver.dob.strftime('%y') : nil
11
+
12
+ regex = Regexp.new("\\A\\d{10}(#{dob_year})?\\z", 'i')
13
+
14
+ # 12 Numeric (last 2 are year of birth) or 10 numeric
15
+ return if driver.license_num.match?(regex)
16
+
17
+ errors.add(:license_num, 'License number requires 12 Numeric (last 2 are year of birth) or 10 numeric for NV.')
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateNy < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ lic_num = driver.license_num
11
+
12
+ return if lic_num.match?(/\A\d{8,9}\z/i)
13
+
14
+ return if lic_num.match?(/\A[a-z]\d{7}\z/i)
15
+
16
+ return if lic_num.match?(/\A[a-z]{8}\z/i)
17
+
18
+ return if lic_num.match?(/\A\d{16}\z/i)
19
+
20
+ return if lic_num.match?(/\A[a-z]\d{18}\z/i)
21
+
22
+ errors.add(
23
+ :license_num,
24
+ [
25
+ 'License number requires 9 Numeric or 8 Numeric or 1 Alphabetic, 7 Numeric or 16 Numeric or 8 Alphabetic',
26
+ 'or 1 Alphabetic, 18 Numeric (not being issued anymore) for NY.'
27
+ ].join(' ')
28
+ )
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateOh < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ lic_num = driver.license_num
11
+
12
+ return if lic_num.match?(/\A[a-z]{2}\d{6}\z/i)
13
+
14
+ return if lic_num.match?(/\A\d{9}\z/i)
15
+
16
+ errors.add(:license_num, 'License number requires 2 Alphabetic, 6 Numeric or 9 Numeric for OH.')
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateOk < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ unless driver.license_num.match?(/\A[a-z]?\d{9}\z/i)
11
+ errors.add(:license_num, 'License number requires 1 letter (optional) followed by 9 numbers for OK.')
12
+ end
13
+
14
+ return if driver.dob.present?
15
+
16
+ errors.add(:dob, 'D.O.B. required for OK.')
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateOr < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ if driver.dob.blank?
11
+ errors.add(:dob, 'D.O.B. is required for OR.')
12
+ end
13
+
14
+ license = driver.license_num
15
+
16
+ return if license.match?(/\A\d{9}\z/i)
17
+
18
+ return if license.match?(/\A[a-z]\d{6}\z/i)
19
+
20
+ return if license.match?(/\A\d{7}\z/i)
21
+
22
+ errors.add(:license_num, 'License number requires 9 Numeric or 1 Alpha, 6 numeric, or 7 numeric for OR.')
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StatePa < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ unless driver.license_num.match?(/\A\d{8}\z/i)
11
+ errors.add(:license_num, 'License number requires 8 numbers for PA.')
12
+ end
13
+
14
+ return if driver.last_name.present?
15
+
16
+ errors.add(:last_name, 'Last name required for PA.')
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateRi < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ lic_num = driver.license_num
11
+
12
+ return if lic_num.match?(/\A\d{7,8}\z/i)
13
+
14
+ return if lic_num.match?(/\AV\d{6}\z/i)
15
+
16
+ errors.add(:license_num, 'License number requires 8 numeric or 7 Numeric or V and 6 Numeric for RI.')
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateSc < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ return if driver.license_num.match?(/\A\d{1,9}\z/i)
11
+
12
+ errors.add(:license_num, 'License number requires 1-9 numbers for SC.')
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateSd < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ lic_num = driver.license_num
11
+
12
+ return if lic_num.match?(/\A\d{6}\z/i)
13
+
14
+ return if lic_num.match?(/\A\d{8,9}\z/i)
15
+
16
+ errors.add(:license_num, 'License number requires 6,8, or 9 numbers for SD.')
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateTn < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ unless driver.license_num.match?(/\A\d{7,9}\z/i)
11
+ errors.add(:license_num, 'License number requires 7-9 numbers for TN.')
12
+ end
13
+
14
+ return if driver.last_name.present?
15
+
16
+ errors.add(:last_name, 'Last name required for TN.')
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateTx < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ unless driver.license_num.match?(/\A[01234]\d{7}\z/i)
11
+ errors.add(:license_num, 'License number requires a 0,1,2,3, or 4 to start and 7 more numbers for TX.')
12
+ end
13
+
14
+ if driver.last_name.blank?
15
+ errors.add(:last_name, 'Last name required for TX.')
16
+ end
17
+
18
+ return if driver.dob.present?
19
+
20
+ errors.add(:dob, 'D.O.B. is required for TX.')
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateUt < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ return if driver.license_num.match?(/\A\d{4,10}\z/i)
11
+
12
+ errors.add(:license_num, 'License number requires 4-10 numbers for UT.')
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseValidator
4
+ module Validations
5
+ class StateVa < LicenseValidator::Validations::Base
6
+ # @see super
7
+ def validate
8
+ super
9
+
10
+ return if driver.license_num.match?(/\A[a-z\d]\d{8}\z/i)
11
+
12
+ errors.add(:license_num, 'License number requires a letter or number followed by 8 numbers for VA.')
13
+ end
14
+ end
15
+ end
16
+ end