Class: WireClient::RegexBasedValidators
- Inherits:
-
BaseValidator
- Object
- ActiveModel::Validator
- BaseValidator
- WireClient::RegexBasedValidators
- Defined in:
- lib/wire_client/base/validators.rb
Direct Known Subclasses
CountryValidator, CreditorIdentifierValidator, CurrencyValidator, MandateIdentifierValidator
Instance Method Summary collapse
Methods inherited from BaseValidator
Instance Method Details
#validate(record) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/wire_client/base/validators.rb', line 14 def validate(record) field_name, value = extract_field_name_value(record) unless value.match(self.class::REGEX) record.errors.add(field_name, :invalid, message: [:message]) end end |