class CpfValidator

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/br_documents/cpf_validator.rb, line 2
def validate_each(record, attribute, value)
  return if value.blank?

  cpf = BrDocuments::CnpjCpf::Cpf.new(value)
  record.errors.add(attribute, :invalid) unless cpf.valid?
end