cpf_cnpj_tools 0.2.1 → 0.2.2

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: 4dd8bd190e08fa8d651a3a05c0af9e63079349d97f9acf05a3b6834d1be41ac4
4
- data.tar.gz: eefd2ac203a2af62b81ebc07c5caac19894d8197be96bc1a4c467a0d398d1745
3
+ metadata.gz: 0b334d9f2cd553e996b9146601f3a3cafed9108379c716c4fb087ed2d5ae1472
4
+ data.tar.gz: e6631210c24a518bdac6493147bf3e47ce6f0eaf54ed0b405138cad48fa7bca1
5
5
  SHA512:
6
- metadata.gz: d4bb2b686d1db66660cc52fa0f1e031ddc91c8ea19010d5a319720d3eab2f23eb97052f0b94c8306aa69d4c15595f97cdcd454b85f26c5f2b63ad1cdc04df2d3
7
- data.tar.gz: 7de836a50aa0bd4576c2b79a694c5bdd5d6e09ed6458602ae36ea9ce9e170583b8862da06801c63a179a99baa600e8087e2e8bfb197629169d925244e56e7024
6
+ metadata.gz: c7abd8c9649f3b3f8a485edf164b397449d5f5f2fd6b5dc1b320bbeddab48faa3a4790ad04d48284f87f1be22b677f96f4e2604ae1754c426f8e08615976047a
7
+ data.tar.gz: '08c10b9bd37f4441946100f8a1ba21e25ead5aacd5037d415b440f526ce381d11fd413a72204d79766e85366711ebc45135d90aad7f278d227d4416ef1961be4'
data/.rubocop.yml CHANGED
@@ -1,22 +1,26 @@
1
- AllCops:
2
- TargetRubyVersion: 2.6
3
-
4
- Style/StringLiterals:
5
- Enabled: true
6
- EnforcedStyle: double_quotes
7
-
8
- Style/StringLiteralsInInterpolation:
9
- Enabled: true
10
- EnforcedStyle: double_quotes
11
-
12
- Layout/LineLength:
13
- Max: 120
14
-
15
- Style/EndOfLine:
16
- Enabled: False
17
-
18
- Lint/ScriptPermission:
19
- Enabled: False
20
-
21
- Metrics/MethodLength:
22
- Max: 15
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+ SuggestExtensions: false
4
+
5
+ Style/StringLiterals:
6
+ Enabled: true
7
+ EnforcedStyle: double_quotes
8
+
9
+ Style/StringLiteralsInInterpolation:
10
+ Enabled: true
11
+ EnforcedStyle: double_quotes
12
+
13
+ Layout/LineLength:
14
+ Max: 120
15
+
16
+ Style/EndOfLine:
17
+ Enabled: False
18
+
19
+ Lint/ScriptPermission:
20
+ Enabled: False
21
+
22
+ Metrics/MethodLength:
23
+ Max: 15
24
+
25
+ Metrics/ClassLength:
26
+ Max: 120
data/CHANGELOG.md CHANGED
@@ -1,13 +1,13 @@
1
- ## [Unreleased]
2
-
3
- ## [0.1.0] - 2022-10-11
4
-
5
- - Initial release
6
-
7
- ## [0.2.0] - 2022-10-12
8
-
9
- - Adding formatation methods
10
-
11
- ## [0.2.1] - 2022-10-12
12
-
13
- - Adding gem dependencies to gemspec
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-10-11
4
+
5
+ - Initial release
6
+
7
+ ## [0.2.0] - 2022-10-12
8
+
9
+ - Adding formatation methods
10
+
11
+ ## [0.2.1] - 2022-10-12
12
+
13
+ - Adding gem dependencies to gemspec
data/README.md CHANGED
@@ -1,40 +1,40 @@
1
- # CpfCnpjTools
2
-
3
- ## Installation
4
-
5
- Install the gem and add to the application's Gemfile by executing:
6
-
7
- $ bundle add cpf_cnpj_tools
8
-
9
- If bundler is not being used to manage dependencies, install the gem by executing:
10
-
11
- $ gem install cpf_cnpj_tools
12
-
13
- ## Usage
14
-
15
- For usage, import the gem and create a new instance of it:
16
-
17
- ```ruby
18
- require "cpf_cnpj_tools"
19
-
20
- generate = CpfCnpjTools::Generator.new
21
-
22
- puts generate.generate_cpf(formatted: false) # returns a valid CPF
23
- puts generate.generate_cnpj(formatted: false) # returns a valid cnpj
24
- puts generate.cpf_valid?("999999900") # validate returning true or false
25
- puts generate.cnpj_valid?("99999999000100") # validate returning true or false
26
- puts generate.formatted?("99999999900") # validate if cpf/cnpj is formatted returning true or false
27
- puts generate.format("16255648800") # return the formatted cpf/cnpj. Ex: 162.556.488-00
28
- ```
29
-
30
- ## Contributing
31
-
32
- Bug reports and pull requests are welcome on GitHub at https://github.com/ariasdiniz/cpf_cnpj_tools. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/ariasdiniz/cpf_cnpj_tools/blob/main/CODE_OF_CONDUCT.md).
33
-
34
- ## License
35
-
36
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
37
-
38
- ## Code of Conduct
39
-
40
- Everyone interacting in the CpfCnpjTools project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ariasdiniz/cpf_cnpj_tools/blob/main/CODE_OF_CONDUCT.md).
1
+ # CpfCnpjTools
2
+
3
+ ## Installation
4
+
5
+ Install the gem and add to the application's Gemfile by executing:
6
+
7
+ $ bundle add cpf_cnpj_tools
8
+
9
+ If bundler is not being used to manage dependencies, install the gem by executing:
10
+
11
+ $ gem install cpf_cnpj_tools
12
+
13
+ ## Usage
14
+
15
+ For usage, import the gem and create a new instance of it:
16
+
17
+ ```ruby
18
+ require "cpf_cnpj_tools"
19
+
20
+ generate = CpfCnpjTools::Generator.new
21
+
22
+ puts generate.generate_cpf(formatted: false) # returns a valid CPF
23
+ puts generate.generate_cnpj(formatted: false) # returns a valid cnpj
24
+ puts generate.cpf_valid?("999999900") # validate returning true or false
25
+ puts generate.cnpj_valid?("99999999000100") # validate returning true or false
26
+ puts generate.formatted?("99999999900") # validate if cpf/cnpj is formatted returning true or false
27
+ puts generate.format("16255648800") # return the formatted cpf/cnpj. Ex: 162.556.488-00
28
+ ```
29
+
30
+ ## Contributing
31
+
32
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ariasdiniz/cpf_cnpj_tools. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/ariasdiniz/cpf_cnpj_tools/blob/main/CODE_OF_CONDUCT.md).
33
+
34
+ ## License
35
+
36
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
37
+
38
+ ## Code of Conduct
39
+
40
+ Everyone interacting in the CpfCnpjTools project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ariasdiniz/cpf_cnpj_tools/blob/main/CODE_OF_CONDUCT.md).
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CpfCnpjTools
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
@@ -1,174 +1,202 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "cpf_cnpj_tools/version"
4
- require_relative "invalid_cpf_cnpj_format_exception"
5
-
6
- module CpfCnpjTools
7
- ##
8
- # Class responsible for generating and
9
- # validating CPF and CNPJ numbers
10
- class Generator
11
- CPF1DIGIT = [10, 9, 8, 7, 6, 5, 4, 3, 2].freeze
12
- CPF2DIGIT = [11, 10, 9, 8, 7, 6, 5, 4, 3, 2].freeze
13
- CNPJ1DIGIT = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2].freeze
14
- CNPJ2DIGIT = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2].freeze
15
-
16
- ##
17
- # Method for generating valid CPF numbers
18
- # @return String
19
- def generate_cpf(formatted: true)
20
- base = generate_base
21
- base << generate_identifier(base, true)
22
- base << generate_identifier(base, false)
23
- return base.join unless formatted
24
-
25
- format(base.join)
26
- end
27
-
28
- ##
29
- # Method for generating valid CNPJ numbers
30
- # @return String
31
- def generate_cnpj(formatted: true)
32
- base = generate_base(cnpj: true)
33
- base << generate_identifier(base, true, cpf: false)
34
- base << generate_identifier(base, false, cpf: false)
35
- return base.join unless formatted
36
-
37
- format(base.join)
38
- end
39
-
40
- ##
41
- # Method for validating CPF numbers.
42
- # @param cpf (String, Integer)
43
- # @return Boolean
44
- def cpf_valid?(cpf)
45
- cpf_array = remove_formatting(cpf.to_s).split("").map!(&:to_i)
46
- first_digit = cpf_array[-2]
47
- second_digit = cpf_array[-1]
48
- base_cpf = cpf_array[0..8]
49
- calculated_first_digit = generate_identifier(base_cpf, true)
50
- calculated_second_digit = generate_identifier(base_cpf << calculated_first_digit, false)
51
- return false if (first_digit != calculated_first_digit) || (second_digit != calculated_second_digit)
52
-
53
- true
54
- end
55
-
56
- ##
57
- # Method for validating CNPJ numbers.
58
- # @param cnpj (String, Integer)
59
- # @return Boolean
60
- def cnpj_valid?(cnpj)
61
- cnpj_array = remove_formatting(cnpj.to_s).split("").map!(&:to_i)
62
- first_digit = cnpj_array[-2]
63
- second_digit = cnpj_array[-1]
64
- base_cnpj = cnpj_array[0..11]
65
- calculated_first_digit = generate_identifier(base_cnpj, true, cpf: false)
66
- calculated_second_digit = generate_identifier(base_cnpj << calculated_first_digit, false, cpf: false)
67
- return false if (first_digit != calculated_first_digit) || (second_digit != calculated_second_digit)
68
-
69
- true
70
- end
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
77
- def formatted?(cpf_or_cnpj)
78
- number = cpf_or_cnpj.to_s
79
- return true if (number =~ /\d{3}\.\d{3}\.\d{3}-\d{2}/) || (number =~ %r{\d{2}\.\d{3}\.\d{3}/0001-\d{2}})
80
-
81
- false
82
- end
83
-
84
- ##
85
- # Returns an unformatted CPF or CNPJ.
86
- # If the value is already unformatted,
87
- # the method returns the value passed as argument.
88
- # @param cpf_or_cnpj (String, Integer)
89
- # @return String
90
- def remove_formatting(cpf_or_cnpj)
91
- unformatted = cpf_or_cnpj.to_s.delete("./-")
92
- return unformatted unless unformatted.nil?
93
-
94
- cpf_or_cnpj.to_s
95
- end
96
-
97
- ##
98
- # Returns a String containing a formatted CPF/CNPJ.
99
- # @param cpf_or_cnpj (String, Integer)
100
- # @return String
101
- def format(cpf_or_cnpj)
102
- if cpf_valid?(cpf_or_cnpj)
103
- cpf = cpf_or_cnpj.to_s.dup
104
- cpf.insert(3, ".")
105
- .insert(7, ".")
106
- .insert(-3, "-")
107
- elsif cnpj_valid?(cpf_or_cnpj)
108
- cnpj = cpf_or_cnpj.to_s.dup
109
- cnpj.insert(2, ".")
110
- .insert(6, ".")
111
- .insert(10, "/")
112
- .insert(-3, "-")
113
- else
114
- raise InvalidCpfCnpjFormatError
115
- end
116
- end
117
-
118
- private
119
-
120
- ##
121
- # Generate the first numbers of CPF/CNPJ
122
- # randomly.
123
- # @param cnpj (Boolean)
124
- # @return (Array)
125
- def generate_base(cnpj: false)
126
- base_number = []
127
- 9.times do
128
- base_number << rand(10)
129
- end
130
- if cnpj
131
- base_number.delete_at(-1)
132
- base_number.push 0, 0, 0, 1
133
- end
134
- base_number
135
- end
136
-
137
- ##
138
- # Generate the first and second identifier numbers
139
- # of the CPF/CNPJ.
140
- # @param first_numbers (Array)
141
- # @param first (Boolean)
142
- # @param cpf (Boolean)
143
- # @return Integer
144
- def generate_identifier(first_numbers, first, cpf: true)
145
- multipliers = if cpf
146
- first ? CPF1DIGIT : CPF2DIGIT
147
- else
148
- first ? CNPJ1DIGIT : CNPJ2DIGIT
149
- end
150
- product = []
151
- first_numbers.length.times do |index|
152
- product << first_numbers[index] * multipliers[index]
153
- end
154
- generate_valid_digit(product)
155
- end
156
-
157
- ##
158
- # Calculates the value of a valid identifier digit.
159
- # @param digits (Array)
160
- # @return Integer
161
- def generate_valid_digit(digits)
162
- sum = 0
163
- digits.each do |item|
164
- sum += item
165
- end
166
- remainder = sum % 11
167
- if remainder < 2
168
- 0
169
- else
170
- 11 - remainder
171
- end
172
- end
173
- end
174
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "cpf_cnpj_tools/version"
4
+ require_relative "invalid_cpf_cnpj_format_exception"
5
+
6
+ module CpfCnpjTools
7
+ ##
8
+ # Class responsible for generating and
9
+ # validating CPF and CNPJ numbers
10
+ class Generator
11
+ CPF1DIGIT = [10, 9, 8, 7, 6, 5, 4, 3, 2].freeze
12
+ CPF2DIGIT = [11, 10, 9, 8, 7, 6, 5, 4, 3, 2].freeze
13
+ CNPJ1DIGIT = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2].freeze
14
+ CNPJ2DIGIT = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2].freeze
15
+
16
+ ##
17
+ # Method for generating valid CPF numbers
18
+ # @param {Boolean} formatted
19
+ # @return String
20
+ def generate_cpf(formatted: true)
21
+ base = generate_base
22
+ base << generate_identifier(base, true)
23
+ base << generate_identifier(base, false)
24
+ return base.join unless formatted
25
+
26
+ format(base.join)
27
+ end
28
+
29
+ ##
30
+ # Method for generating valid CNPJ numbers
31
+ # @param {Boolean} formatted
32
+ # @return String
33
+ def generate_cnpj(formatted: true)
34
+ base = generate_base(cnpj: true)
35
+ base << generate_identifier(base, true, cpf: false)
36
+ base << generate_identifier(base, false, cpf: false)
37
+ return base.join unless formatted
38
+
39
+ format(base.join)
40
+ end
41
+
42
+ ##
43
+ # Method for validating CPF numbers.
44
+ # @param {String, Integer} cpf
45
+ # @return bool
46
+ def cpf_valid?(cpf)
47
+ cpf_array = remove_formatting(cpf.to_s).split("").map!(&:to_i)
48
+ first_digit = cpf_array[-2]
49
+ second_digit = cpf_array[-1]
50
+ base_cpf = cpf_array[0..8]
51
+ calculated_first_digit = generate_identifier(base_cpf, true)
52
+ calculated_second_digit = generate_identifier(base_cpf << calculated_first_digit, false)
53
+ return false if (first_digit != calculated_first_digit) || (second_digit != calculated_second_digit)
54
+
55
+ true
56
+ end
57
+
58
+ ##
59
+ # Method for validating CNPJ numbers.
60
+ # @param {Integer, String} cpf
61
+ # @return bool
62
+ def cnpj_valid?(cnpj)
63
+ cnpj_array = remove_formatting(cnpj.to_s).split("").map!(&:to_i)
64
+ first_digit = cnpj_array[-2]
65
+ second_digit = cnpj_array[-1]
66
+ base_cnpj = cnpj_array[0..11]
67
+ calculated_first_digit = generate_identifier(base_cnpj, true, cpf: false)
68
+ calculated_second_digit = generate_identifier(base_cnpj << calculated_first_digit, false, cpf: false)
69
+ return false if (first_digit != calculated_first_digit) || (second_digit != calculated_second_digit)
70
+
71
+ true
72
+ end
73
+
74
+ ##
75
+ # Return true if the CPF/CNPJ is formatted.
76
+ # Return false if not.
77
+ # @param {String, Integer} cpf_or_cnpj
78
+ # @return bool
79
+ def formatted?(cpf_or_cnpj)
80
+ number = cpf_or_cnpj.to_s
81
+ return true if (number =~ /\d{3}\.\d{3}\.\d{3}-\d{2}/) || (number =~ %r{\d{2}\.\d{3}\.\d{3}/0001-\d{2}})
82
+
83
+ false
84
+ end
85
+
86
+ ##
87
+ # Returns an unformatted CPF or CNPJ.
88
+ # If the value is already unformatted,
89
+ # the method returns the value passed as argument.
90
+ # @param {String, Integer} cpf_or_cnpj
91
+ # @return String
92
+ def remove_formatting(cpf_or_cnpj)
93
+ unformatted = cpf_or_cnpj.to_s.delete("./-")
94
+ return unformatted unless unformatted.nil?
95
+
96
+ cpf_or_cnpj.to_s
97
+ end
98
+
99
+ ##
100
+ # Returns a String containing a formatted CPF/CNPJ.
101
+ # @param {String, Integer} cpf_or_cnpj
102
+ # @return String
103
+ def format(cpf_or_cnpj)
104
+ if cpf_valid?(cpf_or_cnpj)
105
+ cpf = cpf_or_cnpj.to_s.dup
106
+ cpf.insert(3, ".")
107
+ .insert(7, ".")
108
+ .insert(-3, "-")
109
+ elsif cnpj_valid?(cpf_or_cnpj)
110
+ cnpj = cpf_or_cnpj.to_s.dup
111
+ cnpj.insert(2, ".")
112
+ .insert(6, ".")
113
+ .insert(10, "/")
114
+ .insert(-3, "-")
115
+ else
116
+ raise InvalidCpfCnpjFormatError
117
+ end
118
+ end
119
+
120
+ ##
121
+ # Returns an array of valid random generated CPF numbers
122
+ # @param {Integer} number
123
+ # @param {bool} formatted
124
+ # @return {Array[String]}
125
+ def generate_array_of_cpf(number, formatted: true)
126
+ array = []
127
+ number.times do
128
+ array << generate_cpf(formatted: formatted)
129
+ end
130
+ array
131
+ end
132
+
133
+ ##
134
+ # Returns an array of valid random generated CNPJ numbers
135
+ # @param {Integer} number
136
+ # @param {bool} formatted
137
+ # @return {Array[String]}
138
+ def generate_array_of_cnpj(number, formatted: true)
139
+ array = []
140
+ number.times do
141
+ array << generate_cnpj(formatted: formatted)
142
+ end
143
+ array
144
+ end
145
+
146
+ private
147
+
148
+ ##
149
+ # Generate the first numbers of CPF/CNPJ
150
+ # randomly.
151
+ # @param cnpj (Boolean)
152
+ # @return (Array)
153
+ def generate_base(cnpj: false)
154
+ base_number = []
155
+ 9.times do
156
+ base_number << rand(10)
157
+ end
158
+ if cnpj
159
+ base_number.delete_at(-1)
160
+ base_number.push 0, 0, 0, 1
161
+ end
162
+ base_number
163
+ end
164
+
165
+ ##
166
+ # Generate the first and second identifier numbers
167
+ # of the CPF/CNPJ.
168
+ # @param first_numbers (Array)
169
+ # @param first (Boolean)
170
+ # @param cpf (Boolean)
171
+ # @return Integer
172
+ def generate_identifier(first_numbers, first, cpf: true)
173
+ multipliers = if cpf
174
+ first ? CPF1DIGIT : CPF2DIGIT
175
+ else
176
+ first ? CNPJ1DIGIT : CNPJ2DIGIT
177
+ end
178
+ product = []
179
+ first_numbers.length.times do |index|
180
+ product << first_numbers[index] * multipliers[index]
181
+ end
182
+ generate_valid_digit(product)
183
+ end
184
+
185
+ ##
186
+ # Calculates the value of a valid identifier digit.
187
+ # @param digits (Array)
188
+ # @return Integer
189
+ def generate_valid_digit(digits)
190
+ sum = 0
191
+ digits.each do |item|
192
+ sum += item
193
+ end
194
+ remainder = sum % 11
195
+ if remainder < 2
196
+ 0
197
+ else
198
+ 11 - remainder
199
+ end
200
+ end
201
+ end
202
+ end
@@ -1,10 +1,10 @@
1
- # frozen_string_literal: true
2
-
3
- ##
4
- # Error raised when trying to format
5
- # an invalid CPF or CNPJ.
6
- class InvalidCpfCnpjFormatError < StandardError
7
- def initialize(msg = "Invalid CPF or CNPJ.")
8
- super
9
- end
10
- end
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ # Error raised when trying to format
5
+ # an invalid CPF or CNPJ.
6
+ class InvalidCpfCnpjFormatError < StandardError
7
+ def initialize(msg = "Invalid CPF or CNPJ.")
8
+ super
9
+ end
10
+ end
@@ -0,0 +1,24 @@
1
+ module CpfCnpjTools
2
+ class Generator
3
+ CNPJ1DIGIT: Array[Integer]
4
+ CNPJ2DIGIT: Array[Integer]
5
+ CPF1DIGIT: Array[Integer]
6
+ CPF2DIGIT: Array[Integer]
7
+
8
+ def cnpj_valid?: -> bool
9
+
10
+ def cpf_valid?: -> bool
11
+
12
+ def formatted?: -> bool
13
+
14
+ def generate_array_of_cnpj: -> Array[String]
15
+
16
+ def generate_array_of_cpf: -> Array[String]
17
+
18
+ def generate_cnpj: -> String
19
+
20
+ def generate_cpf: -> String
21
+
22
+ def remove_formatting: -> String
23
+ end
24
+ end
metadata CHANGED
@@ -1,57 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpf_cnpj_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aria Diniz
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-12 00:00:00.000000000 Z
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'
11
+ date: 2023-01-02 00:00:00.000000000 Z
12
+ dependencies: []
55
13
  description: With this tool you will be able to generate and validate brazilian CPF
56
14
  and CNPJ numbers.
57
15
  email:
@@ -67,11 +25,11 @@ files:
67
25
  - LICENSE.txt
68
26
  - README.md
69
27
  - Rakefile
70
- - cpf_cnpj_tools.gemspec
71
28
  - lib/cpf_cnpj_tools.rb
72
29
  - lib/cpf_cnpj_tools/version.rb
73
30
  - lib/invalid_cpf_cnpj_format_exception.rb
74
31
  - sig/cpf_cnpj_tools.rbs
32
+ - sig/cpf_cnpj_tools/generator.rbs
75
33
  homepage: https://github.com/ariasdiniz/cpf_cnpj_tools
76
34
  licenses:
77
35
  - MIT
@@ -79,7 +37,7 @@ metadata:
79
37
  documentation_uri: https://rubydoc.info/gems/cpf_cnpj_tools
80
38
  homepage_uri: https://github.com/ariasdiniz/cpf_cnpj_tools
81
39
  source_code_uri: https://github.com/ariasdiniz/cpf_cnpj_tools
82
- post_install_message:
40
+ post_install_message:
83
41
  rdoc_options: []
84
42
  require_paths:
85
43
  - lib
@@ -94,8 +52,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
52
  - !ruby/object:Gem::Version
95
53
  version: '0'
96
54
  requirements: []
97
- rubygems_version: 3.3.7
98
- signing_key:
55
+ rubygems_version: 3.3.26
56
+ signing_key:
99
57
  specification_version: 4
100
58
  summary: A tool for generating and validating CPF/CNPJ numbers
101
59
  test_files: []
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/cpf_cnpj_tools/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "cpf_cnpj_tools"
7
- spec.version = CpfCnpjTools::VERSION
8
- spec.authors = ["Aria Diniz"]
9
- spec.email = ["aria.diniz.dev@gmail.com"]
10
-
11
- spec.summary = "A tool for generating and validating CPF/CNPJ numbers"
12
- spec.description = "With this tool you will be able to generate and validate brazilian CPF and CNPJ numbers."
13
- spec.homepage = "https://github.com/ariasdiniz/cpf_cnpj_tools"
14
- spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.6"
16
-
17
- spec.metadata["documentation_uri"] = "https://rubydoc.info/gems/cpf_cnpj_tools"
18
- spec.metadata["homepage_uri"] = spec.homepage
19
- spec.metadata["source_code_uri"] = "https://github.com/ariasdiniz/cpf_cnpj_tools"
20
-
21
- # Specify which files should be added to the gem when it is released.
22
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
- spec.files = Dir.chdir(__dir__) do
24
- `git ls-files -z`.split("\x0").reject do |f|
25
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
26
- end
27
- end
28
- spec.bindir = "exe"
29
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
- spec.require_paths = ["lib"]
31
-
32
- # Uncomment to register a new dependency of your gem
33
- spec.add_dependency "rake", "~> 13.0"
34
- spec.add_dependency "minitest", "~> 5.0"
35
- spec.add_dependency "rubocop", "~> 1.21"
36
-
37
- # For more information and examples about making a new gem, check out our
38
- # guide at: https://bundler.io/guides/creating_gem.html
39
- end