laranja 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +0 -13
- data/.travis.yml +8 -1
- data/Gemfile +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +14 -97
- data/Rakefile +5 -3
- data/laranja.gemspec +4 -3
- data/lib/laranja.rb +8 -26
- data/lib/laranja/data/pt-BR.yml +26 -0
- data/lib/laranja/generator.rb +43 -0
- data/lib/laranja/generators/pt-BR/documento.rb +37 -0
- data/lib/laranja/generators/pt-BR/endereco.rb +70 -0
- data/lib/laranja/generators/pt-BR/internet.rb +17 -0
- data/lib/laranja/generators/pt-BR/nome.rb +25 -0
- data/lib/laranja/generators/pt-BR/sexo.rb +13 -0
- data/lib/laranja/version.rb +1 -1
- data/test/pt-BR/test_documento.rb +65 -0
- data/test/pt-BR/test_endereco.rb +87 -0
- data/test/pt-BR/test_internet.rb +58 -0
- data/test/pt-BR/test_nome.rb +38 -0
- data/test/pt-BR/test_sexo.rb +21 -0
- data/test/test_helper.rb +5 -0
- metadata +57 -59
- data/.rspec +0 -2
- data/lib/laranja/address.rb +0 -77
- data/lib/laranja/cpf.rb +0 -24
- data/lib/laranja/gender.rb +0 -12
- data/lib/laranja/internet.rb +0 -26
- data/lib/laranja/name.rb +0 -33
- data/lib/static_data.yml +0 -26
- data/spec/address_spec.rb +0 -89
- data/spec/cpf_spec.rb +0 -62
- data/spec/gender_spec.rb +0 -23
- data/spec/internet_spec.rb +0 -77
- data/spec/name_spec.rb +0 -66
- data/spec/spec_helper.rb +0 -7
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3fd37c3884c0fa247a1659a53210b1bc4d70ca34
|
4
|
+
data.tar.gz: 36514c2edc628d2b531e14fcd38fc9684038fa71
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 508ff9017e49c182f3775f6a19ea768efdb70e5f33ee63d70ce804c9dde306f8f7a4634e72fec0022614f65694ffa564bc0d660cc33543635e0a0257ac9b8b58
|
7
|
+
data.tar.gz: 920e2598cbb23468ee63aae503eeef4129cbb831c8fe9f713c00755df52ebb1769605c006ffdb5e477090c1491ca25c513bd7aa07c75471a7091006b1788910a
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
language: ruby
|
2
|
+
os:
|
3
|
+
- linux
|
4
|
+
- osx
|
2
5
|
rvm:
|
6
|
+
- 2.2.2
|
7
|
+
- 2.1.6
|
3
8
|
- 2.0.0
|
4
|
-
- 1.9.3
|
9
|
+
- 1.9.3
|
10
|
+
env:
|
11
|
+
secure: 0Mi2GePEotGmVDxATHkTY5NN7vfgexgW8Fz+16hbcbbNockNsjaU64HQeZ5FWwaKAUBDrYCQf0hooO8kD7XcuwSVEYg+T1M1glhg3wSwMRsZUgyow4AWeCCJ2cqnYiSh1R/1nO8M91cp7TbcLdK/r65x3BFLTd++x82BYWYJgeA=
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
# Laranja
|
2
2
|
[![Build Status](https://travis-ci.org/oesgalha/laranja.png)](https://travis-ci.org/oesgalha/laranja)
|
3
3
|
[![Code Climate](https://codeclimate.com/github/oesgalha/laranja.png)](https://codeclimate.com/github/oesgalha/laranja)
|
4
|
-
[![Coverage
|
4
|
+
[![Test Coverage](https://codeclimate.com/github/oesgalha/laranja/badges/coverage.svg)](https://codeclimate.com/github/oesgalha/laranja/coverage)
|
5
|
+
|
6
|
+
> Os termos "laranja" e "testa de ferro" designam, na linguagem popular, a pessoa que intermedeia transações financeiras fraudulentas, emprestando seu nome, documentos ou conta bancária para ocultar a identidade de quem a contrata.
|
5
7
|
|
6
8
|
Laranja is a ruby gem which generates random fake valid data.
|
7
|
-
It
|
9
|
+
It was built to help testing brazilian apps, since it generated specific data from the country.
|
10
|
+
Now it's localized with the I18n gem, the gem has custom data and custom generators per locale.
|
8
11
|
You can use it in your automated tests or to populate development databases.
|
9
12
|
|
10
13
|
## Installation
|
@@ -23,107 +26,21 @@ Or install it yourself as:
|
|
23
26
|
|
24
27
|
## Usage
|
25
28
|
|
26
|
-
|
27
|
-
|
28
|
-
```ruby
|
29
|
-
require 'laranja'
|
30
|
-
|
31
|
-
Laranja::Name.name # Vitória Pereira
|
32
|
-
|
33
|
-
Laranja::Name.name(2) # Ígor Braga Santos => Name with 2 surnames
|
34
|
-
|
35
|
-
Laranja::Name.first_name # Raul
|
36
|
-
|
37
|
-
Laranja::Name.last_name # Moreira
|
38
|
-
|
39
|
-
Laranja::Name.strf '%male_first_name %last_name %last_name %last_name %male_suffix' # Fabrício Santos Costa Reis Junior
|
40
|
-
|
41
|
-
Laranja::Name.strf '%last_name %male_suffix' # Albuquerque Neto
|
42
|
-
|
43
|
-
Laranja::Name.strf '%title %female_first_name %last_name' # Condessa Ofélia Macedo
|
44
|
-
```
|
45
|
-
|
46
|
-
### CPF
|
47
|
-
|
29
|
+
In order to use the Laranja's generators you need to require it and call load:
|
48
30
|
```ruby
|
49
31
|
require 'laranja'
|
50
32
|
|
51
|
-
Laranja
|
52
|
-
|
53
|
-
Laranja::CPF.formatted # 524.966.867-49
|
54
|
-
|
55
|
-
Laranja::CPF.cpf(:rj) # 29564858739 => Random CPF from Rio de Janeiro
|
56
|
-
|
57
|
-
Laranja::CPF.formatted(:BA) # 101.182.995-90 => Random CPF from Bahia
|
58
|
-
|
59
|
-
Laranja::CPF.cpf('RS') # 73272882014 => Random CPF from Rio Grande do Sul
|
60
|
-
|
61
|
-
Laranja::CPF.cpf('sp') # 07537191859 => Random CPF from São Paulo
|
33
|
+
Laranja.load('pt-BR') # If no locale is passed, will try to use I18n.locale
|
62
34
|
```
|
63
35
|
|
64
|
-
|
65
|
-
|
66
|
-
```ruby
|
67
|
-
require 'laranja'
|
68
|
-
|
69
|
-
Laranja::Internet.email # elsionogueira@gmail.com
|
70
|
-
|
71
|
-
Laranja::Internet.email_for('Vitória Pereira') # vitria.pereira@yahoo.com
|
72
|
-
|
73
|
-
Laranja::Internet.username # marli.macedo
|
74
|
-
|
75
|
-
Laranja::Internet.username_for('Ana Machado') # anamachado
|
36
|
+
Now you can use your locale specific generators.
|
76
37
|
|
77
|
-
|
38
|
+
### Available Locales
|
78
39
|
|
79
|
-
|
80
|
-
|
81
|
-
Laranja::Internet.password(2, 6) # COW => Password with a random number of charaters between 2 and 6 (the default is 8 and 128)
|
82
|
-
```
|
83
|
-
|
84
|
-
### Gender
|
85
|
-
|
86
|
-
```ruby
|
87
|
-
require 'laranja'
|
88
|
-
|
89
|
-
Laranja::Gender.gender # Feminino
|
90
|
-
|
91
|
-
Laranja::Gender.abbr # M
|
92
|
-
```
|
93
|
-
|
94
|
-
### Address
|
95
|
-
|
96
|
-
```ruby
|
97
|
-
require 'laranja'
|
98
|
-
|
99
|
-
Laranja::Address.city # Santo Rafael do Sul
|
100
|
-
|
101
|
-
Laranja::Address.district # Parque Condessa Carvalho
|
102
|
-
|
103
|
-
Laranja::Address.street # Avenida Barão Norberto Martins Neto
|
104
|
-
|
105
|
-
Laranja::Address.secondary # Lote 937
|
106
|
-
|
107
|
-
Laranja::Address.number # 608
|
108
|
-
|
109
|
-
Laranja::Address.formatted_cep # 43519-000
|
110
|
-
|
111
|
-
Laranja::Address.cep # 49738343
|
112
|
-
|
113
|
-
Laranja::Address.cep('SP') # 13663282
|
114
|
-
|
115
|
-
Laranja::Address.formatted_cep(:am) # 64787-398
|
116
|
-
|
117
|
-
Laranja::Address.uf # Rondônia
|
118
|
-
|
119
|
-
Laranja::Address.uf_abbr # MG
|
120
|
-
```
|
40
|
+
- [pt-BR](https://github.com/oesgalha/laranja/wiki/pt-BR)
|
121
41
|
|
122
|
-
|
42
|
+
### TODO
|
123
43
|
|
124
|
-
-
|
125
|
-
-
|
126
|
-
-
|
127
|
-
- RG
|
128
|
-
- Credit Cards
|
129
|
-
- Bank Accounts
|
44
|
+
- Add a CONTRIBUTING.md
|
45
|
+
- Finish stuff in pt-BR
|
46
|
+
- Start en?
|
data/Rakefile
CHANGED
data/laranja.gemspec
CHANGED
@@ -18,9 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency '
|
21
|
+
spec.add_dependency 'i18n', '~> 0.7'
|
22
|
+
spec.add_dependency 'safe_yaml', '~> 1.0'
|
22
23
|
|
23
24
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
24
|
-
spec.add_development_dependency 'rake'
|
25
|
-
spec.add_development_dependency '
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.4'
|
26
|
+
spec.add_development_dependency 'minitest', '~> 5.6'
|
26
27
|
end
|
data/lib/laranja.rb
CHANGED
@@ -1,34 +1,16 @@
|
|
1
1
|
require 'safe_yaml'
|
2
2
|
SafeYAML::OPTIONS[:default_mode] = :safe
|
3
|
+
require 'laranja/version'
|
3
4
|
|
4
5
|
module Laranja
|
5
|
-
class Base
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
protected
|
12
|
-
|
13
|
-
def self.data_sample(key, scope = nil)
|
14
|
-
data(key, scope).sample
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.data(key, scope = nil)
|
18
|
-
static_data[scope || to_s.split('::')[-1].downcase][key]
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
7
|
+
class << self
|
8
|
+
attr_accessor :locale
|
9
|
+
end
|
22
10
|
|
23
|
-
|
24
|
-
|
25
|
-
|
11
|
+
def self.load(locale = nil)
|
12
|
+
self.locale = locale || I18n.locale
|
13
|
+
require 'laranja/generator'
|
14
|
+
Dir.glob(File.dirname(__FILE__) + "/laranja/generators/#{locale}/*.rb") { |f| require f }
|
26
15
|
end
|
27
16
|
end
|
28
|
-
|
29
|
-
require 'laranja/address'
|
30
|
-
require 'laranja/cpf'
|
31
|
-
require 'laranja/gender'
|
32
|
-
require 'laranja/internet'
|
33
|
-
require 'laranja/name'
|
34
|
-
require 'laranja/version'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
endereco:
|
2
|
+
city_prefix: ['Águas de', 'Campos de', 'Monte', 'Nova', 'Velha']
|
3
|
+
city_suffix: ['do Norte', 'do Sul']
|
4
|
+
codigo_cep: { ac: 6, al: 5, ap: 6, am: 6, ba: 4, ce: 6, df: 7, es: 2, go: 7, ma: 6, mt: 7, ms: 7, mg: 3, pa: 6, pb: 5, pr: 8, pe: 5, pi: 6, rj: 2, rn: 5, rs: 9, ro: 7, rr: 6, sc: 8, sp: 1, se: 4, to: 7 }
|
5
|
+
district_prefix: ['Bosque', 'Chácara', 'Jardim', 'Monte', 'Parque', 'Vila']
|
6
|
+
female_city_prefix: ['Nossa Senhora', 'Santa']
|
7
|
+
log_prefix: ['Alameda', 'Avenida', 'Marginal', 'Rodovia', 'Rua', 'Travessa', 'Viela']
|
8
|
+
male_city_prefix: ['Santo', 'São']
|
9
|
+
secondary: ['Ap', 'Casa', 'Lote', 'Quadra']
|
10
|
+
uf_abbr: ['AC', 'AL', 'AP', 'AM', 'BA', 'CE', 'DF', 'ES', 'GO', 'MA', 'MT', 'MS', 'MG', 'PA', 'PB', 'PR', 'PE', 'PI', 'RJ', 'RN', 'RS', 'RO', 'RR', 'SC', 'SP', 'SE', 'TO']
|
11
|
+
uf_name: ['Acre', 'Alagoas', 'Amapá', 'Amazonas', 'Bahia', 'Ceará', 'Distrito Federal', 'Espírito Santo', 'Goiás', 'Maranhão', 'Mato Grosso', 'Mato Grosso do Sul', 'Minas Gerais', 'Pará', 'Paraíba', 'Paraná', 'Pernambuco', 'Piauí', 'Rio de Janeiro', 'Rio Grande do Norte', 'Rio Grande do Sul', 'Rondônia', 'Roraima', 'Santa Catarina', 'São Paulo', 'Sergipe', 'Tocantins']
|
12
|
+
documento:
|
13
|
+
codigo_uf: { ac: 2, al: 4, ap: 2, am: 2, ba: 5, ce: 3, df: 1, es: 7, go: 1, ma: 3, mt: 1, ms: 1, mg: 6, pa: 2, pb: 4, pr: 9, pe: 4, pi: 3, rj: 7, rn: 4, rs: 0, ro: 2, rr: 2, sc: 9, sp: 8, se: 5, to: 1 }
|
14
|
+
sexo:
|
15
|
+
abbr: ['F', 'M']
|
16
|
+
name: ['Feminino', 'Masculino']
|
17
|
+
internet:
|
18
|
+
email: ['bol.com.br', 'gmail.com', 'hotmail.com', 'live.com', 'terra.com.br', 'uol.com.br', 'yahoo.com']
|
19
|
+
nome:
|
20
|
+
female_first_name: ['Alessandra', 'Aline', 'Bruna', 'Carla', 'Célia', 'Cecília', 'Dalila', 'Eduarda', 'Fabrícia', 'Felícia', 'Isabel', 'Isabela', 'Joana', 'Júlia', 'Janaína', 'Karla', 'Lorena', 'Lorraine', 'Larissa', 'Meire', 'Marcela', 'Margarida', 'Mércia', 'Márcia', 'Marli', 'Morgana', 'Maria', 'Natália', 'Núbia', 'Ofélia', 'Paula', 'Rafaela', 'Roberta', 'Sílvia', 'Suélen', 'Sara', 'Talita', 'Vitória']
|
21
|
+
female_title: ['Baronesa', 'Condessa', 'Dra', 'Duquesa', 'Engenheira', 'Imperatriz', 'Princesa', 'Professora']
|
22
|
+
female_suffix: ['Filha']
|
23
|
+
last_name: ['Albuquerque', 'Barros', 'Batista', 'Braga', 'Carvalho', 'Costa', 'Cunha', 'Franco', 'Ladislau', 'Macedo', 'Martins', 'Melo', 'Moraes', 'Moreira', 'Nogueira', 'Oliveira', 'Pereira', 'Reis', 'Santos', 'Saraiva', 'Silva', 'Souza', 'Xavier']
|
24
|
+
male_title: ['Barão', 'Conde', 'Dom', 'Dr', 'Duque', 'Engenheiro', 'General', 'Imperador', 'Presidente', 'Professor']
|
25
|
+
male_first_name: ['Alessandro', 'Alexandre', 'Antônio', 'Breno', 'Carlos', 'César', 'Danilo', 'Deneval', 'Eduardo', 'Esther', 'Elísio', 'Fábio', 'Fabrício', 'Félix', 'Feliciano', 'Frederico', 'Fabiano', 'Gustavo', 'Guilherme', 'Gúbio', 'Heitor', 'Hélio', 'Hugo', 'Ígor', 'João', 'Júlio', 'Kléber', 'Lucas', 'Marcos', 'Marcelo', 'Norberto', 'Paulo', 'Pablo', 'Pedro', 'Raul', 'Rafael', 'Ricardo', 'Roberto', 'Tertuliano', 'Vicente', 'Víctor', 'Yuri', 'Washington']
|
26
|
+
male_suffix: ['Junior', 'Neto', 'Filho']
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Laranja
|
2
|
+
class Generator
|
3
|
+
class << self
|
4
|
+
attr_writer :static_data
|
5
|
+
|
6
|
+
NUMBERS = '0'.upto('9').to_a
|
7
|
+
UPPER = 'A'.upto('Z').to_a
|
8
|
+
LOWER = 'a'.upto('z').to_a
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
def strf(format)
|
13
|
+
symbolize(format).gsub(/(:(?<scope>[^:\s\z]+))?%(?<key>[^%\s\z]+)/) do
|
14
|
+
data_sample($~[:key], $~[:scope])
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def symbolize(format)
|
19
|
+
format.gsub(/#/) {
|
20
|
+
NUMBERS.sample
|
21
|
+
}.gsub(/\*/) {
|
22
|
+
(1 + rand(9)).to_s
|
23
|
+
}.gsub(/&/) {
|
24
|
+
(LOWER + UPPER + NUMBERS).sample
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def data_sample(key, scope = nil)
|
29
|
+
data(key, scope).sample
|
30
|
+
end
|
31
|
+
|
32
|
+
def data(key, scope = nil)
|
33
|
+
static_data[scope || to_s.split('::')[-1].downcase][key]
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def static_data
|
39
|
+
@static_data ||= YAML.load_file(File.join(File.expand_path(File.dirname(__FILE__)), 'data', "#{Laranja.locale}.yml"))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Laranja
|
2
|
+
class Documento < Generator
|
3
|
+
class << self
|
4
|
+
def cpf(uf = nil)
|
5
|
+
cpf = uf.nil? ? strf('#########') : strf('########') + uf_code(uf)
|
6
|
+
cpf + verification_digits(cpf).join
|
7
|
+
end
|
8
|
+
|
9
|
+
def cpf_formatado(uf = nil)
|
10
|
+
c = cpf(uf)
|
11
|
+
'%03d.%03d.%03d-%02d' % [ c[0..2].to_i, c[3..5].to_i, c[6..8].to_i, c[9..10].to_i ]
|
12
|
+
end
|
13
|
+
|
14
|
+
def rg
|
15
|
+
strf '#########'
|
16
|
+
end
|
17
|
+
|
18
|
+
def rg_formatado
|
19
|
+
strf '##.###.###-#'
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def uf_code(uf)
|
25
|
+
data('codigo_uf')[uf.to_s.downcase].to_s
|
26
|
+
end
|
27
|
+
|
28
|
+
def verification_digits(cpf)
|
29
|
+
v = [(0..8).inject(0) { |sum, i| sum + cpf[i].to_i * (10 - i) } % 11]
|
30
|
+
v[0] = v[0] < 2 ? 0 : 11 - v[0]
|
31
|
+
v[1] = ((0..8).inject(0) { |sum, i| sum + cpf[i].to_i * (11 - i) } + v[0] * 2) % 11
|
32
|
+
v[1] = v[1] < 2 ? 0 : 11 - v[1]
|
33
|
+
v
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Laranja
|
2
|
+
class Endereco < Generator
|
3
|
+
class << self
|
4
|
+
def cidade
|
5
|
+
strf [
|
6
|
+
'%city_prefix :nome%last_name',
|
7
|
+
'%city_prefix :nome%last_name %city_suffix',
|
8
|
+
'%city_prefix %female_city_prefix :nome%female_first_name',
|
9
|
+
'%city_prefix %male_city_prefix :nome%male_first_name',
|
10
|
+
'%city_prefix %female_city_prefix :nome%female_first_name %city_suffix',
|
11
|
+
'%city_prefix %male_city_prefix :nome%male_first_name %city_suffix',
|
12
|
+
':nome%last_name %city_suffix',
|
13
|
+
'%female_city_prefix :nome%female_first_name',
|
14
|
+
'%male_city_prefix :nome%male_first_name',
|
15
|
+
'%female_city_prefix :nome%female_first_name %city_suffix',
|
16
|
+
'%male_city_prefix :nome%male_first_name %city_suffix'
|
17
|
+
].sample
|
18
|
+
end
|
19
|
+
|
20
|
+
def bairro
|
21
|
+
strf [
|
22
|
+
'%district_prefix :nome%last_name',
|
23
|
+
'%district_prefix :nome%male_title :nome%last_name',
|
24
|
+
'%district_prefix :nome%female_title :nome%last_name'
|
25
|
+
].sample
|
26
|
+
end
|
27
|
+
|
28
|
+
def rua
|
29
|
+
strf [
|
30
|
+
'%log_prefix :nome%female_title :nome%female_first_name :nome%last_name',
|
31
|
+
'%log_prefix :nome%female_first_name :nome%last_name',
|
32
|
+
'%log_prefix :nome%male_title :nome%male_first_name :nome%last_name :nome%male_suffix',
|
33
|
+
'%log_prefix :nome%male_title :nome%male_first_name :nome%last_name',
|
34
|
+
'%log_prefix :nome%male_first_name :nome%last_name :nome%male_suffix',
|
35
|
+
'%log_prefix :nome%male_first_name :nome%last_name'
|
36
|
+
].sample
|
37
|
+
end
|
38
|
+
|
39
|
+
def complemento
|
40
|
+
strf '%secondary *###'
|
41
|
+
end
|
42
|
+
|
43
|
+
def numero
|
44
|
+
strf '*###'
|
45
|
+
end
|
46
|
+
|
47
|
+
def cep_formatado(ufab = nil)
|
48
|
+
ufab.nil? ? strf('#####-###') : uf_code(ufab) + strf('####-###')
|
49
|
+
end
|
50
|
+
|
51
|
+
def cep(ufab = nil)
|
52
|
+
ufab.nil? ? strf('########') : uf_code(ufab) + strf('#######')
|
53
|
+
end
|
54
|
+
|
55
|
+
def uf
|
56
|
+
strf '%uf_name'
|
57
|
+
end
|
58
|
+
|
59
|
+
def uf_sigla
|
60
|
+
strf '%uf_abbr'
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def uf_code(ufab)
|
66
|
+
data('codigo_cep')[ufab.to_s.downcase].to_s
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Laranja
|
2
|
+
class Internet < Generator
|
3
|
+
class << self
|
4
|
+
def email(name = nil)
|
5
|
+
strf username(name || Laranja::Nome.nome) + '@%email'
|
6
|
+
end
|
7
|
+
|
8
|
+
def username(name = nil, sep = ['', '.', '_'])
|
9
|
+
(name || Laranja::Nome.nome).gsub(/[^a-zA-Z0-9\s]/, '').split.join(sep.sample).downcase
|
10
|
+
end
|
11
|
+
|
12
|
+
def password(min = 8, max = 128)
|
13
|
+
strf '&' * (min + rand(max - min))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|