Coder Social home page Coder Social logo

br-cnpj's People

Contributors

bbcoimbra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

br-cnpj's Issues

Error when validating/generating a very large CNPJ

irb(main):002:0> BR::CNPJ.valid?(100000000000000000191)
RangeError: bignum too big to convert into `long long'
        from /usr/local/lib/ruby/gems/2.0.0/gems/br-cnpj-1.0.1/lib/br/cnpj.rb:44:in `valid?'
        from /usr/local/lib/ruby/gems/2.0.0/gems/br-cnpj-1.0.1/lib/br/cnpj.rb:44:in `valid?'
        from (irb):2
        from /usr/local/bin/irb:12:in `<main>'
irb(main):003:0> BR::CNPJ.new(1000000000000000000,1)
RangeError: integer 1000000000000000000 too big to convert to `int'
        from (irb):3:in `initialize'
        from (irb):3:in `new'
        from (irb):3
        from /usr/local/bin/irb:12:in `<main>'

The same happens with br-cpf gem.

Ruby 1.9.1 e 1.9.2 $ ruby -r'./lib/br/cnpj' -e"p BR::CNPJ.new('1',1).to_s"

Somente nos Rubies 1.9 ao chamar BR::CNPJ.new('1',1).to_s ele retorna um número CNPJ aleatório. Aparentemente ligado ao endereço de memória do objeto string passado como radix.

Diferente do Ruby 1.8 no qual ao passar o objeto reclama:
radix should be greater than -1 or lesser than 10_000_000 (ArgumentError)

Erro de Instalação No debian

Tentei instalar em um server aqui e aconteceu o seguinte erro:

Building native extensions. This could take a while...
ERROR: Error installing br-cnpj:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
checking for stdlib.h... yes
creating Makefile

make
cc -I. -I/usr/lib/ruby/1.8/i486-linux -I/usr/lib/ruby/1.8/i486-linux -I. -DHAVE_STDLIB_H -D_FILE_OFFSET_BITS=64 -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -c ruby_cnpj.c
ruby_cnpj.c: In function ‘t_init_cnpj’:
ruby_cnpj.c:22: error: ‘lldiv_t’ undeclared (first use in this function)
ruby_cnpj.c:22: error: (Each undeclared identifier is reported only once
ruby_cnpj.c:22: error: for each function it appears in.)
ruby_cnpj.c:22: error: expected ‘;’ before ‘v’
ruby_cnpj.c:32: error: ‘v’ undeclared (first use in this function)
make: *** [ruby_cnpj.o] Error 1

Segundo as informações do sistema: Linux version 2.6.26-2-686 (Debian 2.6.26-19) (gcc version 4.1.3 20080704 (prerelease) (Debian 4.1.2-25))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.