cpf_cnpj_tools 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7d9d6635470921bf186a6348efe25fa7ee27c724be249310355e5f1c37a229b
4
- data.tar.gz: 3ae4d8e0bf686a9b749728cdc2b246b52a5b2c21459b2401c9d0e135c66aa564
3
+ metadata.gz: 4dd8bd190e08fa8d651a3a05c0af9e63079349d97f9acf05a3b6834d1be41ac4
4
+ data.tar.gz: eefd2ac203a2af62b81ebc07c5caac19894d8197be96bc1a4c467a0d398d1745
5
5
  SHA512:
6
- metadata.gz: b7ee4d37f9949766db7d72586394badfb74dc28bea3f04396dd5624e775ae1db2621fdf1f25f88dbc2b2c26ac765a1418ce313efd8c12e34dd328710db094424
7
- data.tar.gz: 95f4e0df9235d19681183db299c24b1c75b3e309b175a3b79e2c209391c76314fd261139ba1530f506feedd2be18530911b01f268c218859e68072cec0e82131
6
+ metadata.gz: d4bb2b686d1db66660cc52fa0f1e031ddc91c8ea19010d5a319720d3eab2f23eb97052f0b94c8306aa69d4c15595f97cdcd454b85f26c5f2b63ad1cdc04df2d3
7
+ data.tar.gz: 7de836a50aa0bd4576c2b79a694c5bdd5d6e09ed6458602ae36ea9ce9e170583b8862da06801c63a179a99baa600e8087e2e8bfb197629169d925244e56e7024
data/CHANGELOG.md CHANGED
@@ -7,3 +7,7 @@
7
7
  ## [0.2.0] - 2022-10-12
8
8
 
9
9
  - Adding formatation methods
10
+
11
+ ## [0.2.1] - 2022-10-12
12
+
13
+ - Adding gem dependencies to gemspec
data/README.md CHANGED
@@ -19,8 +19,8 @@ require "cpf_cnpj_tools"
19
19
 
20
20
  generate = CpfCnpjTools::Generator.new
21
21
 
22
- puts generate.generate_cpf # returns a valid CPF
23
- puts generate.generate_cnpj # returns a valid cnpj
22
+ puts generate.generate_cpf(formatted: false) # returns a valid CPF
23
+ puts generate.generate_cnpj(formatted: false) # returns a valid cnpj
24
24
  puts generate.cpf_valid?("999999900") # validate returning true or false
25
25
  puts generate.cnpj_valid?("99999999000100") # validate returning true or false
26
26
  puts generate.formatted?("99999999900") # validate if cpf/cnpj is formatted returning true or false
@@ -30,7 +30,9 @@ Gem::Specification.new do |spec|
30
30
  spec.require_paths = ["lib"]
31
31
 
32
32
  # Uncomment to register a new dependency of your gem
33
- # spec.add_dependency "example-gem", "~> 1.0"
33
+ spec.add_dependency "rake", "~> 13.0"
34
+ spec.add_dependency "minitest", "~> 5.0"
35
+ spec.add_dependency "rubocop", "~> 1.21"
34
36
 
35
37
  # For more information and examples about making a new gem, check out our
36
38
  # guide at: https://bundler.io/guides/creating_gem.html
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CpfCnpjTools
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
@@ -69,6 +69,11 @@ module CpfCnpjTools
69
69
  true
70
70
  end
71
71
 
72
+ ##
73
+ # Return true if the CPF/CNPJ is formatted.
74
+ # Return false if not.
75
+ # @param cpf_or_cnpj (String, Integer)
76
+ # @return Boolean
72
77
  def formatted?(cpf_or_cnpj)
73
78
  number = cpf_or_cnpj.to_s
74
79
  return true if (number =~ /\d{3}\.\d{3}\.\d{3}-\d{2}/) || (number =~ %r{\d{2}\.\d{3}\.\d{3}/0001-\d{2}})
@@ -89,6 +94,10 @@ module CpfCnpjTools
89
94
  cpf_or_cnpj.to_s
90
95
  end
91
96
 
97
+ ##
98
+ # Returns a String containing a formatted CPF/CNPJ.
99
+ # @param cpf_or_cnpj (String, Integer)
100
+ # @return String
92
101
  def format(cpf_or_cnpj)
93
102
  if cpf_valid?(cpf_or_cnpj)
94
103
  cpf = cpf_or_cnpj.to_s.dup
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpf_cnpj_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aria Diniz
@@ -9,7 +9,49 @@ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
11
  date: 2022-10-12 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '13.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '13.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.21'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.21'
13
55
  description: With this tool you will be able to generate and validate brazilian CPF
14
56
  and CNPJ numbers.
15
57
  email: