Skip to content
calcules and validates Brazilian CNPJ
Ruby C
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
ext/CNPJ
lib/br
spec
.document
.gitignore
Gemfile
Gemfile.lock
LICENSE
README.markdown
Rakefile
TODO
VERSION
br-cnpj.gemspec

README.markdown

br-cnpj travis-ci build status Code ClimateGem VersionDependency Status

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

MIT Licence. Copyright (c) 2009-2013 Bruno Coimbra. Veja o arquivo LICENSE para mais detalhes.

Something went wrong with that request. Please try again.