class SEPA::MandateIdentifierValidator

Constants

REGEX

Public Instance Methods

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

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