Sha256: 9ae5747283d2b5d732e53788a296b76d5932a168f90a794201ccbbb94b3a463b
Contents?: true
Size: 335 Bytes
Versions: 1
Compression:
Stored size: 335 Bytes
Contents
# frozen_string_literal: true class CnpjValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) cnpj = ValidatesCnpj::Cnpj.new(value) if cnpj.valid? record.send("#{attribute}=", cnpj.number) if options[:mask] else record.errors.add(attribute, :invalid, options) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
validates_cnpj-3.0.0 | lib/validates_cnpj/cnpj_validator.rb |