Class: LicenseValidator::Validations::StateWa

Inherits:
Base
  • Object
show all
Defined in:
lib/license_validator/validations/state_wa.rb

Instance Attribute Summary

Attributes inherited from Base

#driver, #errors, #infos, #warnings

Instance Method Summary collapse

Methods inherited from Base

human_attribute_name, #initialize, lookup_ancestors, #read_attribute_for_validation, #validation_results

Constructor Details

This class inherits a constructor from LicenseValidator::Validations::Base

Instance Method Details

#validateObject

See Also:

  • super


7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/license_validator/validations/state_wa.rb', line 7

def validate
  super

  return if driver.license_num.match?(/\A[0-9a-z*]{12}\z/i)

  errors.add(
    :license_num,
    [
      'License number requires 5 alphabetic (last name), 1 alphabetic (first name), 1 alphabetic (middle name),',
      '3 numeric, 1 alphabetic, 1 alphanumeric or 12 alphanumeric or “WDL”, 9 alphanumeric for WA.',
      'Names should be padded with *'
    ].join(' ')
  )
end