cpf_simplifier 0.1.1 → 0.1.2
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/Gemfile.lock +34 -0
- data/cpf_simplifier-0.1.1.gem +0 -0
- data/lib/cpf_simplifier/version.rb +1 -1
- data/lib/cpf_simplifier.rb +9 -8
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 20bd77cd6f62ec97603588ce447394a8e485754dd3712a68dbfc576c2238b9b2
|
|
4
|
+
data.tar.gz: e88eab8267e9ce79f93557fa7eb3d264ff9dbf3102511b6055a8669aac4d9df5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 79ea36ef01d3247f7cf6891ad5c28bf7c734052f5ba3d3267355568c6a605c356dab9763452cf5e4b96fd68a6b72a5e18fc872d2f460ceb5044800dd1488d11d
|
|
7
|
+
data.tar.gz: 53464746a6e99a69267cf0110790ec249bbefe81134cf1901db7c54bdfc01a2279d5a15293a7d55bdb9eeccc4bd2364a8044c5eabea1096f0c7d8b5488a67ce8
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
cpf_simplifier (0.1.1)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
diff-lcs (1.4.4)
|
|
10
|
+
rake (13.0.6)
|
|
11
|
+
rspec (3.10.0)
|
|
12
|
+
rspec-core (~> 3.10.0)
|
|
13
|
+
rspec-expectations (~> 3.10.0)
|
|
14
|
+
rspec-mocks (~> 3.10.0)
|
|
15
|
+
rspec-core (3.10.1)
|
|
16
|
+
rspec-support (~> 3.10.0)
|
|
17
|
+
rspec-expectations (3.10.1)
|
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
19
|
+
rspec-support (~> 3.10.0)
|
|
20
|
+
rspec-mocks (3.10.2)
|
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
22
|
+
rspec-support (~> 3.10.0)
|
|
23
|
+
rspec-support (3.10.2)
|
|
24
|
+
|
|
25
|
+
PLATFORMS
|
|
26
|
+
x86_64-linux
|
|
27
|
+
|
|
28
|
+
DEPENDENCIES
|
|
29
|
+
cpf_simplifier!
|
|
30
|
+
rake (~> 13.0)
|
|
31
|
+
rspec (~> 3.0)
|
|
32
|
+
|
|
33
|
+
BUNDLED WITH
|
|
34
|
+
2.2.15
|
|
Binary file
|
data/lib/cpf_simplifier.rb
CHANGED
|
@@ -7,23 +7,24 @@ module CpfSimplifier
|
|
|
7
7
|
class Error < StandardError; end
|
|
8
8
|
# Your code goes here...
|
|
9
9
|
|
|
10
|
-
# Formata
|
|
10
|
+
# Formata cpf no padrao de vizualizaçao de usuario (999.999.999.99)
|
|
11
11
|
# Caso seja informado um valor nulo, retorna uma string vazia
|
|
12
|
-
def format_cpf
|
|
13
|
-
|
|
12
|
+
def format_cpf
|
|
13
|
+
to_s.gsub(/([0-9]{3})([0-9]{3})([0-9]{3})([0-9]{2})/, '\1.\2.\3-\4')
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def unformat_default
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
def unformat_default
|
|
17
|
+
# E a mesma coisa que /\.|-|\//, mas nao precisa escapar / com \/
|
|
18
|
+
regex = %r{\.|-|/}
|
|
19
|
+
to_s.gsub(regex, '')
|
|
19
20
|
end
|
|
20
21
|
alias unformat_nis unformat_default
|
|
21
22
|
alias unformat_cpf unformat_default
|
|
22
23
|
alias unformat_cnpj unformat_default
|
|
23
24
|
alias unformat_date unformat_default
|
|
24
25
|
|
|
25
|
-
def reformat_cpf
|
|
26
|
-
format_cpf(unformat_cpf(
|
|
26
|
+
def reformat_cpf
|
|
27
|
+
format_cpf(unformat_cpf(self))
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cpf_simplifier
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pedro Augusto Paião L. da Silva
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-09-
|
|
11
|
+
date: 2021-09-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email:
|
|
@@ -22,11 +22,13 @@ files:
|
|
|
22
22
|
- CHANGELOG.md
|
|
23
23
|
- CODE_OF_CONDUCT.md
|
|
24
24
|
- Gemfile
|
|
25
|
+
- Gemfile.lock
|
|
25
26
|
- README.md
|
|
26
27
|
- Rakefile
|
|
27
28
|
- bin/console
|
|
28
29
|
- bin/setup
|
|
29
30
|
- cpf_simplifier-0.1.0.gem
|
|
31
|
+
- cpf_simplifier-0.1.1.gem
|
|
30
32
|
- cpf_simplifier.gemspec
|
|
31
33
|
- lib/cpf_simplifier.rb
|
|
32
34
|
- lib/cpf_simplifier/version.rb
|