brazilian_id 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,8 @@ class CNPJ < BrazilianID
2
2
  def number_length; 14; end;
3
3
 
4
4
  def to_s
5
- "#{sequential.scan(/\d{3}/).join('.')}-#{check_digits}"
5
+ er = /^(.{2})(.{3})(.{3})(.{4})(.{2})/
6
+ "#{@number.gsub(er, '\1.\2.\3/\4-\5')}"
6
7
  end
7
8
 
8
9
  def inspect
@@ -1,3 +1,3 @@
1
1
  module BrazilianId
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/spec/cnpj_spec.rb CHANGED
@@ -2,4 +2,6 @@ require File.join(File.dirname(__FILE__), '..', 'lib', 'brazilian_id.rb')
2
2
 
3
3
  describe CNPJ do
4
4
  it { CNPJ.new('18781203/0001-28').should be_valid }
5
+ it { CNPJ.new('18781203000128').to_s.should == '18.781.203/0001-28' }
6
+
5
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brazilian_id
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Halan Pinheiro