Sha256: ed4f93046a5e0e7ac140b10f1ef685ef3afc23c2a349a457344fe57290b64e06
Contents?: true
Size: 455 Bytes
Versions: 4
Compression:
Stored size: 455 Bytes
Contents
module Brid class CNPJ < GenericID def number_length; 14; end def check_digits_length; 2; end; def to_s er = /^(.{2})(.{3})(.{3})(.{4})(.{2})/ "#{@number.gsub(er, '\1.\2.\3/\4-\5')}" end def inspect "#<CNPJ: #{to_s} #{valid? ? 'valid': 'not valid'} >" end private def mod11 number Mod11.new(number, :base => 2..9) end end end CNPJ = Brid::CNPJ if not defined? CNPJ and not defined? Cnpj
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
brid-0.1.3 | lib/brid/ids/cnpj.rb |
brid-0.1.2 | lib/brid/ids/cnpj.rb |
brid-0.1.1 | lib/brid/ids/cnpj.rb |
brid-0.1.0 | lib/brid/ids/cnpj.rb |