Skip to content

nathmisaki/br-cnpj

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

br-cnpj

Ruby native extension that calculates and validades CNPJ (Cadastro Nacional de Pessoas Jurídicas)

Install

sudo gem install br-cnpj

Examples

require 'rubygems'
require 'br/cnpj'

BR::CNPJ.valid? '00000000000191'
 => true

BR::CNPJ.valid? 191
 => true

BR::CNPJ.valid? 192
 => false

radix = 0
filial = 1
BR::CNPJ.new(radix, filial).to_s
 => '00000000000191'

BR::CNPJ.new(191).valid?
 => true

BR::CNPJ.new(1234567891011).valid?
 => false

BR::CNPJ.format(191)
 => '00.000.000/0001-91'

BR::CNPJ.unformat('00.000.000/0001-91')
 => '00000000000191'

Copyright © 2010 Bruno Coimbra. Veja o arquivo LICENSE para mais detalhes.

About

calcules and validates Brazilian CNPJ

Resources

License

Stars

Watchers

Forks

Packages

No packages published