Class: Laranja::Documento
Constant Summary
Constants inherited
from Generator
Generator::ALL, Generator::NUMBERS
Class Method Summary
collapse
Class Method Details
.cpf(uf = nil) ⇒ Object
4
5
6
7
|
# File 'lib/laranja/generators/pt-BR/documento.rb', line 4
def cpf(uf = nil)
number = strf('########') + uf_code(uf)
number + verification_digits(number).join
end
|
9
10
11
12
|
# File 'lib/laranja/generators/pt-BR/documento.rb', line 9
def cpf_formatado(uf = nil)
c = cpf(uf)
'%03d.%03d.%03d-%02d' % [ c[0..2].to_i, c[3..5].to_i, c[6..8].to_i, c[9..10].to_i ]
end
|
.rg ⇒ Object
14
15
16
|
# File 'lib/laranja/generators/pt-BR/documento.rb', line 14
def rg
strf('#########')
end
|
18
19
20
|
# File 'lib/laranja/generators/pt-BR/documento.rb', line 18
def rg_formatado
strf('##.###.###-#')
end
|