Sha256: 10a366e7db11c0bdcd94704850b9f6cca214afe9ca6be8e6659897041dd57617

Contents?: true

Size: 250 Bytes

Versions: 2

Compression:

Stored size: 250 Bytes

Contents

require "active_model"
require "validates_cpf/cpf"

class CpfValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    record.errors[attribute] << I18n.t("errors.messages.invalid") unless CPF.new(value).valid?
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
validates_cpf-0.2.2 lib/validates_cpf.rb
validates_cpf-0.2.1 lib/validates_cpf.rb