Class: LicenseValidator::Validations::StateTx
- Defined in:
- lib/license_validator/validations/state_tx.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 |
# File 'lib/license_validator/validations/state_tx.rb', line 7 def validate super unless driver.license_num.match?(/\A[012345]\d{7}\z/i) errors.add(:license_num, 'License number requires a 0,1,2,3,4, or 5 to start and 7 more numbers for TX.') end if driver.last_name.blank? errors.add(:last_name, 'Last name required for TX.') end return if driver.dob.present? errors.add(:dob, 'D.O.B. is required for TX.') end |