doc_validator 1.2.4 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +20 -2
- data/lib/doc_validator/cnpj.rb +2 -0
- data/lib/doc_validator/cpf.rb +2 -0
- data/lib/doc_validator/rg.rb +2 -0
- data/lib/doc_validator/version.rb +3 -1
- data/lib/doc_validator.rb +6 -4
- metadata +18 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e9c436938bf3b0446c98c28368e858c82074bf81f7bc01a7ef1b8e6642b40c8
|
4
|
+
data.tar.gz: ecdd8ebf5cb2b9957a22cca79457c1b7415afff91cb8783168893c5817233778
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99d405fdf9b97a773b5c82b9e394b9efbc82b666784d62e23f70631c5e78030ab2f65aea42c5b992c550fb9fd8c82aa1df69627e83851d1ae6f8f11efb1be33c
|
7
|
+
data.tar.gz: d7f3cdb654aff74bd6c8afb9af32041becbcb93930ae5ecfd16570ccbb2bd3516d49b5720058ddef57fbb77cf905704ac6cef280320e62c512f99aa7c6dc17e3
|
data/README.md
CHANGED
@@ -40,6 +40,12 @@ Para formatar um CPF, use o método `.format`:
|
|
40
40
|
DocValidator::Cpf.format("12345678909") # Retorna "123.456.789-09"
|
41
41
|
```
|
42
42
|
|
43
|
+
Para máscara um CNPJ, use o método `.mask`:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
DocValidator::Cnpj.mask("12345678909") # Retorna "***.456.789-**"
|
47
|
+
```
|
48
|
+
|
43
49
|
### Validação de CNPJ
|
44
50
|
|
45
51
|
Para validar um CNPJ, use o método `.valid?`:
|
@@ -55,19 +61,31 @@ Para formatar um CNPJ, use o método `.format`:
|
|
55
61
|
DocValidator::Cnpj.format("12345678000195") # Retorna "12.345.678/0001-95"
|
56
62
|
```
|
57
63
|
|
64
|
+
Para máscara um CNPJ, use o método `.mask`:
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
DocValidator::Cnpj.mask("12345678000195") # Retorna "**.*345.678/0001-**"
|
68
|
+
```
|
69
|
+
|
58
70
|
### Validação de RG
|
59
71
|
|
60
72
|
Para validar um RG, use o método `.valid?`:
|
61
73
|
|
62
74
|
```ruby
|
63
|
-
DocValidator::Rg.valid?("12.345.678
|
75
|
+
DocValidator::Rg.valid?("12.345.678-9") # Retorna true
|
64
76
|
DocValidator::Rg.valid?("11.234.567/0001-000") # Retorna false
|
65
77
|
```
|
66
78
|
|
67
79
|
Para formatar um RG, use o método `.format`:
|
68
80
|
|
69
81
|
```ruby
|
70
|
-
DocValidator::Rg.format("
|
82
|
+
DocValidator::Rg.format("123456789") # Retorna "12.345.678-9"
|
83
|
+
```
|
84
|
+
|
85
|
+
Para máscara um RG, use o método `.mask`:
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
DocValidator::Rg.mask("123456789") # Retorna "***.345.678-*"
|
71
89
|
```
|
72
90
|
|
73
91
|
### Validação de CNH
|
data/lib/doc_validator/cnpj.rb
CHANGED
data/lib/doc_validator/cpf.rb
CHANGED
data/lib/doc_validator/rg.rb
CHANGED
data/lib/doc_validator.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'doc_validator/version'
|
4
|
+
require 'doc_validator/cpf'
|
5
|
+
require 'doc_validator/cnpj'
|
6
|
+
require 'doc_validator/rg'
|
5
7
|
|
6
8
|
module DocValidator
|
7
9
|
# Aqui você pode incluir métodos gerais, se necessário
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doc_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maikon Douglas
|
@@ -10,75 +10,75 @@ cert_chain: []
|
|
10
10
|
date: 2025-03-31 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
|
-
name:
|
13
|
+
name: bundler-audit
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: '
|
18
|
+
version: '0.9'
|
19
19
|
type: :runtime
|
20
20
|
prerelease: false
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - "~>"
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: '
|
25
|
+
version: '0.9'
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
|
-
name:
|
27
|
+
name: pry
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
30
|
- - "~>"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '0.
|
32
|
+
version: '0.13'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.13'
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
|
-
name:
|
41
|
+
name: rspec
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0
|
46
|
+
version: '3.0'
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0
|
53
|
+
version: '3.0'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
|
-
name:
|
55
|
+
name: rubocop
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '0
|
60
|
+
version: '1.0'
|
61
61
|
type: :runtime
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '0
|
67
|
+
version: '1.0'
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
|
-
name:
|
69
|
+
name: simplecov
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '0.21'
|
75
75
|
type: :runtime
|
76
76
|
prerelease: false
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
81
|
+
version: '0.21'
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: bundler
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,6 +112,7 @@ metadata:
|
|
112
112
|
homepage_uri: https://github.com/maikondouglas/doc_validator
|
113
113
|
source_code_uri: https://github.com/maikondouglas/doc_validator
|
114
114
|
bug_tracker_uri: https://github.com/maikondouglas/doc_validator/issues
|
115
|
+
rubygems_mfa_required: 'true'
|
115
116
|
rdoc_options: []
|
116
117
|
require_paths:
|
117
118
|
- lib
|
@@ -126,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
127
|
- !ruby/object:Gem::Version
|
127
128
|
version: '0'
|
128
129
|
requirements: []
|
129
|
-
rubygems_version: 3.6.
|
130
|
+
rubygems_version: 3.6.2
|
130
131
|
specification_version: 4
|
131
132
|
summary: Uma gem para validação e formatação de documentos
|
132
133
|
test_files: []
|