randamu 0.0.1 → 0.0.3
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/lib/randamu/core/academic.rb +4 -3
- data/lib/randamu/core/account.rb +9 -7
- data/lib/randamu/core/person.rb +1 -1
- data/lib/randamu/core/text.rb +5 -10
- data/lib/randamu/generators/document_generator.rb +2 -2
- data/lib/randamu/generators/name_generator.rb +1 -5
- data/lib/randamu/support/dictionary.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4f557bc3003d936d24d790027efdeff376fc68c9af000df9442a8686ecd140e
|
4
|
+
data.tar.gz: e6d463809113e374ed9a2d80c1146bad96d60f747e74643d57381684bed13776
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95c7f7e9b827b1da9dc6ef7f1854ec56a6b497e5818f601ad51fc48f5429b1c16e82f2902d27e6db68b07a2b247c3ed7e80e2aa36dbf4264101e8315af1d2e9b
|
7
|
+
data.tar.gz: 5f926d0ebf7dec4bfcc6e72eaffddd28d9dcacd70e45758886d4c6689fa5ccacd9677c165f5bd9a25ceff1cefa13304166fdbc1825c124796b9a29d912ab2b62
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Randamu
|
2
|
-
class Academic
|
2
|
+
class Academic < Base
|
3
3
|
class << self
|
4
4
|
def education_level
|
5
5
|
['Educação infantil', 'Fundamental', 'Médio',
|
@@ -10,14 +10,15 @@ module Randamu
|
|
10
10
|
load_data('academic.courses').sample
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def school
|
14
14
|
load_data('academic.schools').sample
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
17
|
+
def university
|
18
18
|
load_data('academic.universities').sample
|
19
19
|
end
|
20
20
|
|
21
|
+
alias :college :university
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
data/lib/randamu/core/account.rb
CHANGED
@@ -5,10 +5,12 @@ module Randamu
|
|
5
5
|
ALPHABET = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
6
6
|
NUMERIC = '0123456789'
|
7
7
|
SPEACIAL = '!@#$%&*()_+'
|
8
|
-
|
8
|
+
USERNAME_TYPES = %i[default funny]
|
9
9
|
class << self
|
10
10
|
def username(type: :default)
|
11
|
-
load_data("names.usernames.#{type}").sample
|
11
|
+
return load_data("names.usernames.#{type}").sample if USERNAME_TYPES.include?(type)
|
12
|
+
|
13
|
+
load_data('names.usernames.default').sample
|
12
14
|
end
|
13
15
|
|
14
16
|
def password(length: 8, special: true, numeric: true, alphabet: true)
|
@@ -20,13 +22,13 @@ module Randamu
|
|
20
22
|
end
|
21
23
|
|
22
24
|
def phone(state: Dictionary::STATES.keys.sample, country_code: false)
|
23
|
-
|
24
|
-
"
|
25
|
+
base_phone_number = "(#{load_data("phone.ddd.#{state.upcase}").sample}) " + phone_number
|
26
|
+
country_code ? "+55 #{base_phone_number}" : base_phone_number
|
25
27
|
end
|
26
28
|
|
27
29
|
def phone_only_numbers(state: Dictionary::STATES.keys.sample, country_code: false)
|
28
|
-
|
29
|
-
"#{
|
30
|
+
base_phone_number = load_data("phone.ddd.#{state.upcase}").sample.to_s + phone_number
|
31
|
+
country_code ? "55#{base_phone_number}" : base_phone_number
|
30
32
|
end
|
31
33
|
|
32
34
|
private
|
@@ -48,6 +50,6 @@ module Randamu
|
|
48
50
|
end
|
49
51
|
|
50
52
|
# private methods from NameGenerator
|
51
|
-
private_class_method :first_name, :last_name, :full_name
|
53
|
+
private_class_method :first_name, :last_name, :full_name
|
52
54
|
end
|
53
55
|
end
|
data/lib/randamu/core/person.rb
CHANGED
data/lib/randamu/core/text.rb
CHANGED
@@ -1,17 +1,12 @@
|
|
1
1
|
module Randamu
|
2
2
|
class Text < Base
|
3
|
+
FORMATS = %i(upcase downcase capitalize)
|
3
4
|
class << self
|
4
5
|
def word(format: nil)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
load_data('texts.lorem').sample.downcase
|
10
|
-
when :capitalize
|
11
|
-
load_data('texts.lorem').sample.capitalize
|
12
|
-
else
|
13
|
-
load_data('texts.lorem').sample
|
14
|
-
end
|
6
|
+
word = load_data('texts.lorem').sample
|
7
|
+
return word.send(format) if format && FORMATS.include?(format.to_sym)
|
8
|
+
|
9
|
+
word
|
15
10
|
end
|
16
11
|
|
17
12
|
def title(words: 3)
|
@@ -2,7 +2,7 @@ module DocumentGenerator
|
|
2
2
|
def cpf(valid: true)
|
3
3
|
return generate_valid_cpf if valid
|
4
4
|
|
5
|
-
|
5
|
+
generate_invalid_cpf
|
6
6
|
end
|
7
7
|
|
8
8
|
def rg
|
@@ -40,7 +40,7 @@ module DocumentGenerator
|
|
40
40
|
cpf.join
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
43
|
+
def generate_invalid_cpf
|
44
44
|
cpf = generate_valid_cpf
|
45
45
|
last_digit = cpf[-1]
|
46
46
|
|
@@ -12,11 +12,7 @@ module NameGenerator
|
|
12
12
|
load_db(:last).sample
|
13
13
|
end
|
14
14
|
|
15
|
-
def full_name(gender: nil)
|
16
|
-
"#{first_name(gender: gender)} #{last_name}"
|
17
|
-
end
|
18
|
-
|
19
|
-
def custom_name(length: 3, gender: nil)
|
15
|
+
def full_name(gender: nil, length: 2)
|
20
16
|
generate_custom_name(first_name(gender: gender), length)
|
21
17
|
end
|
22
18
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: randamu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jorge Coutinho
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Random data generators
|
14
14
|
email: jorgecoutinhodsn@gmail.com
|