class SEPA::MandateIdentifierValidator

Constants

REGEX

Public Instance Methods

validate(record) click to toggle source
# File lib/sepa_king/validator.rb, line 50
def validate(record)
  field_name = options[:field_name] || :mandate_id
  value = record.send(field_name)

  record.errors.add(field_name, :invalid, message: options[:message]) unless value.to_s.match(REGEX)
end