Project

br-cnpj

0.01
No release in over 3 years
Low commit activity in last 3 years
Lib implemented in C that calculates and validates CNPJ.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.2.9
 Project Readme

br-cnpj Code ClimateGem Version

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.