Class: LicenseValidator::Validations::StateMo
- Defined in:
- lib/license_validator/validations/state_mo.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
#validate ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/license_validator/validations/state_mo.rb', line 7 def validate super lic_num = driver.license_num return if lic_num.match?(/\A\d{3}[a-z]\d{6}\z/i) return if lic_num.match?(/\A[a-z]\d{5,9}\z/i) return if lic_num.match?(/\A\d{9}[a-z]?\z/i) return if lic_num.match?(/\A[a-z]\d{8}MA\z/i) return if lic_num.match?(/\A\d{15}\z/i) errors.add( :license_num, [ 'License number requires 3 numeric, 1 alphabetic, 6 numeric or 1 alphabetic, 5-9 numeric or 9 numeric or', '1 alphabetic, 8 numeric, 2 alphabetic “MA” or 9 numeric, 1 alphabetic, or 15 numeric for MO.' ].join(' ') ) end |