ffaker 2.6.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +5 -0
- data/README.md +8 -0
- data/REFERENCE.md +21 -1
- data/Rakefile +1 -1
- data/ffaker.gemspec +6 -6
- data/lib/ffaker.rb +2 -2
- data/lib/ffaker/address.rb +9 -9
- data/lib/ffaker/address_au.rb +2 -2
- data/lib/ffaker/address_br.rb +2 -2
- data/lib/ffaker/address_ca.rb +2 -2
- data/lib/ffaker/address_da.rb +2 -2
- data/lib/ffaker/address_de.rb +2 -2
- data/lib/ffaker/address_fi.rb +1 -2
- data/lib/ffaker/address_fr.rb +1 -1
- data/lib/ffaker/address_gr.rb +2 -2
- data/lib/ffaker/address_id.rb +1 -1
- data/lib/ffaker/address_in.rb +3 -5
- data/lib/ffaker/address_kr.rb +9 -8
- data/lib/ffaker/address_mx.rb +2 -2
- data/lib/ffaker/address_nl.rb +1 -1
- data/lib/ffaker/address_pl.rb +5 -5
- data/lib/ffaker/address_ru.rb +1 -1
- data/lib/ffaker/address_ua.rb +3 -3
- data/lib/ffaker/address_us.rb +2 -2
- data/lib/ffaker/avatar.rb +1 -1
- data/lib/ffaker/book.rb +2 -2
- data/lib/ffaker/boolean.rb +1 -1
- data/lib/ffaker/cheesy_lingo.rb +2 -2
- data/lib/ffaker/color.rb +2 -2
- data/lib/ffaker/company.rb +6 -6
- data/lib/ffaker/company_cn.rb +2 -2
- data/lib/ffaker/company_it.rb +18 -2
- data/lib/ffaker/company_se.rb +4 -4
- data/lib/ffaker/data/company_it/piva_office_codes +99 -0
- data/lib/ffaker/education.rb +8 -8
- data/lib/ffaker/filesystem.rb +3 -3
- data/lib/ffaker/food.rb +1 -1
- data/lib/ffaker/gender.rb +1 -1
- data/lib/ffaker/gender_br.rb +1 -1
- data/lib/ffaker/gender_cn.rb +1 -1
- data/lib/ffaker/gender_id.rb +1 -1
- data/lib/ffaker/gender_kr.rb +1 -1
- data/lib/ffaker/html_ipsum.rb +4 -4
- data/lib/ffaker/identification.rb +1 -1
- data/lib/ffaker/identification_br.rb +1 -1
- data/lib/ffaker/identification_es.rb +1 -1
- data/lib/ffaker/identification_es_cl.rb +2 -2
- data/lib/ffaker/identification_es_co.rb +5 -5
- data/lib/ffaker/identification_mx.rb +4 -4
- data/lib/ffaker/internet.rb +9 -9
- data/lib/ffaker/internet_se.rb +6 -8
- data/lib/ffaker/job_fr.rb +2 -2
- data/lib/ffaker/lorem.rb +2 -2
- data/lib/ffaker/lorem_ar.rb +2 -2
- data/lib/ffaker/lorem_cn.rb +2 -2
- data/lib/ffaker/lorem_fr.rb +2 -2
- data/lib/ffaker/lorem_kr.rb +2 -2
- data/lib/ffaker/lorem_ru.rb +2 -2
- data/lib/ffaker/lorem_ua.rb +3 -3
- data/lib/ffaker/movie.rb +7 -7
- data/lib/ffaker/name.rb +4 -11
- data/lib/ffaker/name_br.rb +2 -2
- data/lib/ffaker/name_cs.rb +13 -11
- data/lib/ffaker/name_da.rb +3 -3
- data/lib/ffaker/name_de.rb +2 -2
- data/lib/ffaker/name_fr.rb +2 -4
- data/lib/ffaker/name_ga.rb +3 -10
- data/lib/ffaker/name_gr.rb +3 -3
- data/lib/ffaker/name_id.rb +2 -2
- data/lib/ffaker/name_it.rb +3 -6
- data/lib/ffaker/name_mx.rb +8 -8
- data/lib/ffaker/name_nb.rb +3 -4
- data/lib/ffaker/name_nl.rb +5 -5
- data/lib/ffaker/name_ph.rb +4 -6
- data/lib/ffaker/name_pl.rb +4 -4
- data/lib/ffaker/name_ru.rb +14 -12
- data/lib/ffaker/name_se.rb +3 -4
- data/lib/ffaker/name_sn.rb +13 -19
- data/lib/ffaker/name_ua.rb +1 -1
- data/lib/ffaker/nato_alphabet.rb +2 -2
- data/lib/ffaker/phone_number.rb +16 -16
- data/lib/ffaker/phone_number_au.rb +7 -7
- data/lib/ffaker/phone_number_br.rb +7 -7
- data/lib/ffaker/phone_number_ch.rb +7 -7
- data/lib/ffaker/phone_number_cu.rb +10 -10
- data/lib/ffaker/phone_number_de.rb +2 -2
- data/lib/ffaker/phone_number_fr.rb +4 -4
- data/lib/ffaker/phone_number_id.rb +1 -1
- data/lib/ffaker/phone_number_kr.rb +4 -4
- data/lib/ffaker/phone_number_mx.rb +2 -2
- data/lib/ffaker/phone_number_nl.rb +3 -3
- data/lib/ffaker/phone_number_se.rb +3 -3
- data/lib/ffaker/phone_number_sg.rb +1 -1
- data/lib/ffaker/phone_number_sn.rb +5 -5
- data/lib/ffaker/product.rb +9 -9
- data/lib/ffaker/ssn_se.rb +4 -4
- data/lib/ffaker/string.rb +3 -3
- data/lib/ffaker/time.rb +6 -1
- data/lib/ffaker/utils/module_utils.rb +5 -0
- data/lib/ffaker/utils/unique_utils.rb +45 -0
- data/lib/ffaker/vehicle.rb +5 -5
- data/scripts/reference.rb +1 -1
- data/test/test_address_gr.rb +5 -5
- data/test/test_address_ja.rb +2 -1
- data/test/test_address_kr.rb +1 -0
- data/test/test_array_utils.rb +3 -3
- data/test/test_color.rb +1 -1
- data/test/test_company_it.rb +5 -1
- data/test/test_identification_es_mx.rb +1 -1
- data/test/test_module_utils.rb +1 -1
- data/test/test_name_ar.rb +4 -6
- data/test/test_name_cs.rb +2 -2
- data/test/test_name_ja.rb +2 -2
- data/test/test_name_ru.rb +2 -2
- data/test/test_phone_number.rb +2 -2
- data/test/test_string.rb +1 -1
- data/test/test_time.rb +9 -1
- data/test/test_unique_utils.rb +54 -0
- metadata +6 -2
@@ -10,11 +10,11 @@ module FFaker
|
|
10
10
|
extend ModuleUtils
|
11
11
|
extend self
|
12
12
|
|
13
|
-
BLOOD_TYPE = %w
|
14
|
-
LICENSE_CATEGORY = %w
|
13
|
+
BLOOD_TYPE = %w[A B O AB].freeze
|
14
|
+
LICENSE_CATEGORY = %w[A B C].freeze
|
15
15
|
|
16
16
|
def drivers_license
|
17
|
-
how_many_numbers =
|
17
|
+
how_many_numbers = rand(6..13)
|
18
18
|
FFaker.numerify('#' * how_many_numbers)
|
19
19
|
end
|
20
20
|
|
@@ -23,12 +23,12 @@ module FFaker
|
|
23
23
|
def driver_license_category
|
24
24
|
category = fetch_sample(LICENSE_CATEGORY)
|
25
25
|
# the categories are A1 A2 B1 B2 B3 C1 C2 C3
|
26
|
-
num = category == 'A' ?
|
26
|
+
num = category == 'A' ? rand(1..2) : rand(1..3)
|
27
27
|
"#{category}#{num}"
|
28
28
|
end
|
29
29
|
|
30
30
|
def blood_type # RH
|
31
|
-
sign = fetch_sample(%w
|
31
|
+
sign = fetch_sample(%w[+ -])
|
32
32
|
"#{fetch_sample(BLOOD_TYPE)}#{sign}"
|
33
33
|
end
|
34
34
|
|
@@ -8,8 +8,8 @@ module FFaker
|
|
8
8
|
extend ModuleUtils
|
9
9
|
extend self
|
10
10
|
|
11
|
-
CONSONANTS = %w
|
12
|
-
VOWELS = %w
|
11
|
+
CONSONANTS = %w[B C D F G H J K L M N P Q R S T V W X Y Z].freeze
|
12
|
+
VOWELS = %w[A E I O U].freeze
|
13
13
|
HOMOCLAVE = CONSONANTS + VOWELS + [*'0'..'9']
|
14
14
|
|
15
15
|
# http://es.wikipedia.org/wiki/Registro_Federal_de_Contribuyentes_(M%C3%A9xico)
|
@@ -46,7 +46,7 @@ module FFaker
|
|
46
46
|
# Clave Única de Registro de Población
|
47
47
|
def curp
|
48
48
|
all_letters = CONSONANTS + VOWELS
|
49
|
-
hm = %w
|
49
|
+
hm = %w[H M]
|
50
50
|
date = ::Time.at(rand * ::Time.now.to_f).strftime('%y%m%d')
|
51
51
|
[
|
52
52
|
fetch_sample(CONSONANTS),
|
@@ -57,7 +57,7 @@ module FFaker
|
|
57
57
|
fetch_sample(ESTADOS_CURP),
|
58
58
|
fetch_sample(CONSONANTS, count: 3).join,
|
59
59
|
fetch_sample(HOMOCLAVE),
|
60
|
-
rand(
|
60
|
+
rand(0..9)
|
61
61
|
].join
|
62
62
|
end
|
63
63
|
end
|
data/lib/ffaker/internet.rb
CHANGED
@@ -6,11 +6,11 @@ module FFaker
|
|
6
6
|
extend self
|
7
7
|
|
8
8
|
BYTE = [*'0'..'255'].freeze
|
9
|
-
HOSTS = %w
|
10
|
-
DISPOSABLE_HOSTS = %w
|
11
|
-
DOMAIN_SUFFIXES = %w
|
12
|
-
SAFE_DOMAIN_SUFFIXES = %w
|
13
|
-
SLUG_DELIMITERS = %w
|
9
|
+
HOSTS = %w[gmail.com yahoo.com hotmail.com].freeze
|
10
|
+
DISPOSABLE_HOSTS = %w[mailinator.com suremail.info spamherelots.com binkmail.com safetymail.info].freeze
|
11
|
+
DOMAIN_SUFFIXES = %w[co.uk com us ca biz info name].freeze
|
12
|
+
SAFE_DOMAIN_SUFFIXES = %w[org com net].freeze
|
13
|
+
SLUG_DELIMITERS = %w[- _ .].freeze
|
14
14
|
MAC_LIMIT = 281_474_976_710_655
|
15
15
|
|
16
16
|
def email(name = nil)
|
@@ -33,14 +33,14 @@ module FFaker
|
|
33
33
|
|
34
34
|
def user_name(name = nil)
|
35
35
|
if name
|
36
|
-
parts = shuffle(name.scan(/\w+/)).join(fetch_sample(%w
|
36
|
+
parts = shuffle(name.scan(/\w+/)).join(fetch_sample(%w[. _]))
|
37
37
|
parts.downcase
|
38
38
|
else
|
39
|
-
case rand(
|
39
|
+
case rand(0..1)
|
40
40
|
when 0
|
41
41
|
sanitize(Name.first_name)
|
42
42
|
when 1
|
43
|
-
[Name.first_name, Name.last_name].map { |n| sanitize(n) }.join(fetch_sample(%w
|
43
|
+
[Name.first_name, Name.last_name].map { |n| sanitize(n) }.join(fetch_sample(%w[. _]))
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -85,7 +85,7 @@ module FFaker
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def mac(delimiter = ':')
|
88
|
-
rand(MAC_LIMIT).to_s(16).rjust(12, '0').scan(/.{2}/).join(delimiter)
|
88
|
+
rand(0...MAC_LIMIT).to_s(16).rjust(12, '0').scan(/.{2}/).join(delimiter)
|
89
89
|
end
|
90
90
|
|
91
91
|
private
|
data/lib/ffaker/internet_se.rb
CHANGED
@@ -10,10 +10,10 @@ module FFaker
|
|
10
10
|
extend self
|
11
11
|
|
12
12
|
BYTE = [*'0'..'255'].freeze
|
13
|
-
HOSTS = %w
|
14
|
-
DOMAIN_SUFFIXES = %w
|
15
|
-
DISPOSABLE_HOSTS = %w
|
16
|
-
SLUG_DELIMITERS = %w
|
13
|
+
HOSTS = %w[gmail.com yahoo.com hotmail.com spray.se passagen.se].freeze
|
14
|
+
DOMAIN_SUFFIXES = %w[se nu com].freeze
|
15
|
+
DISPOSABLE_HOSTS = %w[mailinator.com suremail.info spamherelots.com binkmail.com safetymail.info].freeze
|
16
|
+
SLUG_DELIMITERS = %w[- _ .].freeze
|
17
17
|
|
18
18
|
def email(name = nil)
|
19
19
|
"#{user_name(name)}@#{domain_name}"
|
@@ -42,11 +42,9 @@ module FFaker
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def user_name_random
|
45
|
-
|
46
|
-
case variant
|
45
|
+
case rand(0..1)
|
47
46
|
when 0 then user_name_variant_short
|
48
47
|
when 1 then user_name_variant_long
|
49
|
-
else user_name_variant_short
|
50
48
|
end
|
51
49
|
end
|
52
50
|
|
@@ -68,7 +66,7 @@ module FFaker
|
|
68
66
|
end
|
69
67
|
|
70
68
|
def join_to_user_name(array_parts)
|
71
|
-
join_char = fetch_sample(%w
|
69
|
+
join_char = fetch_sample(%w[. _])
|
72
70
|
array_parts.map(&:downcase).join(join_char)
|
73
71
|
end
|
74
72
|
|
data/lib/ffaker/job_fr.rb
CHANGED
@@ -5,10 +5,10 @@ module FFaker
|
|
5
5
|
extend ModuleUtils
|
6
6
|
extend self
|
7
7
|
|
8
|
-
JOB_ADJECTIVES = %w
|
8
|
+
JOB_ADJECTIVES = %w[general adjoint associé].freeze
|
9
9
|
|
10
10
|
def title
|
11
|
-
if rand(
|
11
|
+
if rand(0..1).zero?
|
12
12
|
"#{fetch_sample(JOB_PREFIXES)} #{fetch_sample(JOB_ADJECTIVES)} #{fetch_sample(JOB_NOUNS)}"
|
13
13
|
else
|
14
14
|
"#{fetch_sample(JOB_PREFIXES)} #{fetch_sample(JOB_NOUNS)}"
|
data/lib/ffaker/lorem.rb
CHANGED
@@ -19,7 +19,7 @@ module FFaker
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def sentence(word_count = 4)
|
22
|
-
first_word, *last_words = words(word_count + rand(5)
|
22
|
+
first_word, *last_words = words(word_count + rand(1..5))
|
23
23
|
if last_words.nil?
|
24
24
|
first_word.capitalize
|
25
25
|
else
|
@@ -36,7 +36,7 @@ module FFaker
|
|
36
36
|
alias phrases sentences
|
37
37
|
|
38
38
|
def paragraph(sentence_count = 3)
|
39
|
-
sentences(sentence_count + rand(
|
39
|
+
sentences(sentence_count + rand(0..2)).join(' ')
|
40
40
|
end
|
41
41
|
|
42
42
|
def paragraphs(paragraph_count = 3)
|
data/lib/ffaker/lorem_ar.rb
CHANGED
@@ -15,7 +15,7 @@ module FFaker
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def sentence(word_count = 4)
|
18
|
-
s = words(word_count + rand(
|
18
|
+
s = words(word_count + rand(0..5))
|
19
19
|
s = s.join(' ')
|
20
20
|
s.capitalize!
|
21
21
|
"#{s}."
|
@@ -30,7 +30,7 @@ module FFaker
|
|
30
30
|
alias phrases sentences
|
31
31
|
|
32
32
|
def paragraph(sentence_count = 3)
|
33
|
-
sentences(sentence_count + rand(
|
33
|
+
sentences(sentence_count + rand(0..2)).join(' ')
|
34
34
|
end
|
35
35
|
|
36
36
|
def paragraphs(paragraph_count = 3)
|
data/lib/ffaker/lorem_cn.rb
CHANGED
@@ -15,7 +15,7 @@ module FFaker
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def sentence(word_count = 4)
|
18
|
-
s = words(word_count + rand(
|
18
|
+
s = words(word_count + rand(0..5))
|
19
19
|
s = s.join
|
20
20
|
"#{s},"
|
21
21
|
end
|
@@ -31,7 +31,7 @@ module FFaker
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def paragraph(sentence_count = 3)
|
34
|
-
sentences(sentence_count + rand(
|
34
|
+
sentences(sentence_count + rand(0..2)).to_s
|
35
35
|
end
|
36
36
|
|
37
37
|
def paragraphs(paragraph_count = 3)
|
data/lib/ffaker/lorem_fr.rb
CHANGED
@@ -14,7 +14,7 @@ module FFaker
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def sentence(word_count = 4)
|
17
|
-
s = words(word_count + rand(
|
17
|
+
s = words(word_count + rand(0..5))
|
18
18
|
s = s.join(' ')
|
19
19
|
s.capitalize!
|
20
20
|
"#{s}."
|
@@ -29,7 +29,7 @@ module FFaker
|
|
29
29
|
alias phrases sentences
|
30
30
|
|
31
31
|
def paragraph(sentence_count = 3)
|
32
|
-
sentences(sentence_count + rand(
|
32
|
+
sentences(sentence_count + rand(0..2)).join(' ')
|
33
33
|
end
|
34
34
|
|
35
35
|
def paragraphs(paragraph_count = 3)
|
data/lib/ffaker/lorem_kr.rb
CHANGED
@@ -14,7 +14,7 @@ module FFaker
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def sentence(word_count = 4)
|
17
|
-
"#{words(word_count + rand(5)
|
17
|
+
"#{words(word_count + rand(1..5)).join(' ')}."
|
18
18
|
end
|
19
19
|
|
20
20
|
alias phrase sentence
|
@@ -26,7 +26,7 @@ module FFaker
|
|
26
26
|
alias phrases sentences
|
27
27
|
|
28
28
|
def paragraph(sentence_count = 3)
|
29
|
-
sentences(sentence_count + rand(
|
29
|
+
sentences(sentence_count + rand(0..2)).join(' ')
|
30
30
|
end
|
31
31
|
|
32
32
|
def paragraphs(paragraph_count = 3)
|
data/lib/ffaker/lorem_ru.rb
CHANGED
@@ -15,7 +15,7 @@ module FFaker
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def sentence(word_count = 7)
|
18
|
-
elements = words(word_count + rand(
|
18
|
+
elements = words(word_count + rand(0..9))
|
19
19
|
elements.insert(rand(3..(elements.count - 3)), ',') if elements.count > 10
|
20
20
|
result = elements.join(' ').gsub(' , ', ', ')
|
21
21
|
capitalize_russian("#{result}#{sentence_type_mark}")
|
@@ -30,7 +30,7 @@ module FFaker
|
|
30
30
|
alias phrases sentences
|
31
31
|
|
32
32
|
def paragraph(sentence_count = 5)
|
33
|
-
sentences(sentence_count + rand(
|
33
|
+
sentences(sentence_count + rand(0..2)).join(' ')
|
34
34
|
end
|
35
35
|
|
36
36
|
def paragraphs(paragraph_count = 3)
|
data/lib/ffaker/lorem_ua.rb
CHANGED
@@ -14,7 +14,7 @@ module FFaker
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def sentence(word_count = 7)
|
17
|
-
elements = words(word_count + rand(
|
17
|
+
elements = words(word_count + rand(0..9))
|
18
18
|
elements.insert(rand(3..(elements.count - 3)), ',') if elements.count > 10
|
19
19
|
result = elements.join(' ').gsub(' , ', ', ')
|
20
20
|
capitalize_ukrainian("#{result}#{sentence_type_mark}")
|
@@ -29,7 +29,7 @@ module FFaker
|
|
29
29
|
alias phrases sentences
|
30
30
|
|
31
31
|
def paragraph(sentence_count = 5)
|
32
|
-
sentences(sentence_count + rand(
|
32
|
+
sentences(sentence_count + rand(0..2)).join(' ')
|
33
33
|
end
|
34
34
|
|
35
35
|
def paragraphs(paragraph_count = 3)
|
@@ -39,7 +39,7 @@ module FFaker
|
|
39
39
|
private
|
40
40
|
|
41
41
|
def sentence_type_mark
|
42
|
-
case rand(
|
42
|
+
case rand(0..9)
|
43
43
|
when 0..7 then '.'
|
44
44
|
when 8 then '!'
|
45
45
|
when 9 then '?'
|
data/lib/ffaker/movie.rb
CHANGED
@@ -9,12 +9,12 @@ module FFaker
|
|
9
9
|
'from Hell', 'from Outer Space', 'from Mars', 'from the Black Lagoon', 'with a Thousand Faces',
|
10
10
|
'from Across the Ocean', 'Who Fell to Earth', 'That Came to Dinner'
|
11
11
|
].freeze
|
12
|
-
COLORS = %w
|
12
|
+
COLORS = %w[Red Yellow Black White].freeze
|
13
13
|
|
14
|
-
RATINGS = %w
|
14
|
+
RATINGS = %w[G PG PG-13 R NC-17].freeze # According to MPAA
|
15
15
|
|
16
16
|
def title
|
17
|
-
case rand(
|
17
|
+
case rand(0..3)
|
18
18
|
when 0 then title_with_prefix
|
19
19
|
when 1 then title_with_suffix
|
20
20
|
when 2 then simple_title
|
@@ -37,7 +37,7 @@ module FFaker
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def maybe_adj_or_adv
|
40
|
-
fetch_sample(ADJ_AND_ADV) + ' ' if rand(
|
40
|
+
fetch_sample(ADJ_AND_ADV) + ' ' if rand(0..1) == 1
|
41
41
|
end
|
42
42
|
|
43
43
|
def simple_title
|
@@ -45,15 +45,15 @@ module FFaker
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def title_from_formula
|
48
|
-
case rand(
|
48
|
+
case rand(0..12)
|
49
49
|
when 0 then "#{fetch_sample(NOUNS)} 2: Electric Boogaloo"
|
50
50
|
when 1 then "The #{fetch_sample(NOUNS)} Without a #{fetch_sample(NOUNS)}"
|
51
|
-
when 2 then "The #{fetch_sample(NOUNS)} from #{rand(20_000)} Leagues"
|
51
|
+
when 2 then "The #{fetch_sample(NOUNS)} from #{rand(0...20_000)} Leagues"
|
52
52
|
when 3 then "#{simple_title}: The #{FFaker::Name.name} Story"
|
53
53
|
when 4 then "When #{FFaker::Name.first_name} Met #{FFaker::Name.first_name}"
|
54
54
|
when 5 then "Dr. #{fetch_sample(NOUNS)}"
|
55
55
|
when 6 then "Je Vous Presente, #{FFaker::Name.first_name}"
|
56
|
-
when 7 then "#{rand(
|
56
|
+
when 7 then "#{rand(0...2999)} A.D."
|
57
57
|
when 8 then "The #{fetch_sample(NOUNS)} from #{FFaker::Address.neighborhood}"
|
58
58
|
when 9 then "Christmas on #{FFaker::Address.street_name}"
|
59
59
|
when 10 then "The #{fetch_sample(COLORS)} Rose of #{FFaker::AddressUK.country}"
|
data/lib/ffaker/name.rb
CHANGED
@@ -5,12 +5,12 @@ module FFaker
|
|
5
5
|
extend ModuleUtils
|
6
6
|
extend self
|
7
7
|
|
8
|
-
MALE_PREFIXES = %w
|
9
|
-
FEMALE_PREFIXES = %w
|
10
|
-
OTHER_PREFIXES = %w
|
8
|
+
MALE_PREFIXES = %w[Mr.].freeze
|
9
|
+
FEMALE_PREFIXES = %w[Mrs. Miss.].freeze
|
10
|
+
OTHER_PREFIXES = %w[Ms. Dr.].freeze
|
11
11
|
PREFIXES = (MALE_PREFIXES + FEMALE_PREFIXES + OTHER_PREFIXES).freeze
|
12
12
|
FIRST_NAMES = (FIRST_NAMES_FEMALE + FIRST_NAMES_MALE).freeze
|
13
|
-
SUFFIXES = %w
|
13
|
+
SUFFIXES = %w[Jr. Sr. I II III IV V MD DDS PhD DVM].freeze
|
14
14
|
|
15
15
|
def name
|
16
16
|
"#{first_name} #{last_name}"
|
@@ -94,13 +94,6 @@ module FFaker
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
-
def html_safe_last_name
|
98
|
-
loop do
|
99
|
-
t = LAST_NAMES.sample
|
100
|
-
return t unless t.include? "'"
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
97
|
def prefix
|
105
98
|
fetch_sample(PREFIXES)
|
106
99
|
end
|
data/lib/ffaker/name_br.rb
CHANGED
@@ -5,8 +5,8 @@ module FFaker
|
|
5
5
|
extend ModuleUtils
|
6
6
|
extend self
|
7
7
|
|
8
|
-
MALE_PREFIXES = %w
|
9
|
-
FEMALE_PREFIXES = %w
|
8
|
+
MALE_PREFIXES = %w[Sr.].freeze
|
9
|
+
FEMALE_PREFIXES = %w[Sra. Srta.].freeze
|
10
10
|
PREFIXES = (MALE_PREFIXES + FEMALE_PREFIXES).freeze
|
11
11
|
FIRST_NAMES = (FIRST_NAMES_FEMALE + FIRST_NAMES_MALE).freeze
|
12
12
|
|
data/lib/ffaker/name_cs.rb
CHANGED
@@ -10,15 +10,15 @@ module FFaker
|
|
10
10
|
extend self
|
11
11
|
|
12
12
|
FIRST_NAMES = {
|
13
|
-
female: %w
|
14
|
-
male: %w
|
13
|
+
female: %w[Alena Andrea Anna Barbora Božena Dagmar Dana Eliška Eva Hana Helena Irena Ivana Jana Jarmila Jaroslava Jiřina Jitka Kateřina Kristýna Lenka Libuše Lucie Ludmila Marcela Marie Markéta Marta Martina Michaela Miroslava Monika Pavla Petra Tereza Věra Veronika Vlasta Zdeňka Zuzana],
|
14
|
+
male: %w[Adam Aleš Alexandr Alois Antonín Bedřich Bohumil Bohuslav Břetislav Dalibor Daniel David Denis Dominik Dušan Eduard Emil Filip František Ivan Ivo Jakub Jan Jaromír Jaroslav Jindřich Jiří Josef Jozef Kamil Karel Kryštof Ladislav Leoš Libor Lubomír Luboš Luděk Ludvík Lukáš Marcel Marek Marian Martin Matěj Matyáš Michael Michal Milan Miloslav Miloš Miroslav Oldřich Ondřej Otakar Patrik Pavel Petr Přemysl Radek Radim Radomír Radovan René Richard Robert Roman Rostislav Rudolf Samuel Stanislav Šimon Štefan Štěpán Tadeáš Tomáš Václav Viktor Vilém Vít Vítězslav Vladimír Vladislav Vlastimil Vojtěch Vratislav Zbyněk Zdeněk]
|
15
15
|
}.freeze
|
16
16
|
LAST_NAMES = {
|
17
|
-
female: %w
|
18
|
-
male: %w
|
17
|
+
female: %w[Dvořáková Černá Benešová Fialová Doležalová Čermáková Blažková Bartošová Čechová Dostálová Bláhová Burešová Dušková Beranová Bednářová Bártová Fišerová Bílková Beránková Brožová Čížková Adámková Daňková Filipová Červenková Čapková Bendová Adamcová Dvořáčková Brabcová Davidová Březinová Dlouhá Dohnalová Burianová Dufková Fojtíková Burdová Červená Boháčová Bartoňová Doleželová Dudová Adamová Bauerová Divišová Coufalová Čejková Berková Balážová],
|
18
|
+
male: %w[Dvořák Černý Beneš Fiala Doležal Čermák Blažek Bartoš Čech Dostál Bláha Bureš Dušek Beran Bednář Bárta Bílek Beránek Fišer Brož Čížek Filip Červenka Adámek Daněk Dvořáček Benda Adamec Brabec Březina David Burian Čapek Dohnal Dlouhý Fojtík Bartoň Červený Dufek Burda Duda Adam Boháč Doležel Baláž Diviš Coufal Bauer Dolejší]
|
19
19
|
}.freeze
|
20
|
-
SUFFIXES = %w
|
21
|
-
GENDERS = [
|
20
|
+
SUFFIXES = %w[Ph.D. Th.D. DSc.].freeze
|
21
|
+
GENDERS = %i[male female random].freeze # :nodoc:
|
22
22
|
|
23
23
|
# All names generated inside the block will have the same sex.
|
24
24
|
# Can be called with explicit sex which will affect
|
@@ -32,7 +32,7 @@ module FFaker
|
|
32
32
|
# person.last_name # => "Nováková"
|
33
33
|
# person.first_name # => "Jana"
|
34
34
|
def with_same_sex(sex = :random)
|
35
|
-
@fixed_sex = sex == :random ? GENDERS[rand(
|
35
|
+
@fixed_sex = sex == :random ? GENDERS[rand(0..1)] : sex
|
36
36
|
yield
|
37
37
|
ensure
|
38
38
|
@fixed_sex = nil
|
@@ -46,7 +46,7 @@ module FFaker
|
|
46
46
|
# for_sex defaults to :random.
|
47
47
|
def name(for_sex = :random)
|
48
48
|
with_same_sex(for_sex) do
|
49
|
-
case rand(
|
49
|
+
case rand(0..9)
|
50
50
|
when 0 then "#{prefix} #{first_name} #{last_name} #{suffix}"
|
51
51
|
when 1..2 then "#{prefix} #{first_name} #{last_name}"
|
52
52
|
else "#{first_name} #{last_name}"
|
@@ -79,9 +79,11 @@ module FFaker
|
|
79
79
|
private
|
80
80
|
|
81
81
|
def select_sex(sex) # :nodoc:
|
82
|
-
|
83
|
-
|
84
|
-
|
82
|
+
@fixed_sex ||= nil
|
83
|
+
given_sex = @fixed_sex || sex
|
84
|
+
raise ArgumentError, "Unknown sex #{given_sex}" \
|
85
|
+
unless GENDERS.include?(given_sex)
|
86
|
+
given_sex == :random ? GENDERS[rand(0..1)] : given_sex
|
85
87
|
end
|
86
88
|
end
|
87
89
|
end
|
data/lib/ffaker/name_da.rb
CHANGED
@@ -9,7 +9,7 @@ module FFaker
|
|
9
9
|
extend ModuleUtils
|
10
10
|
extend self
|
11
11
|
|
12
|
-
PREFIXES = %w
|
12
|
+
PREFIXES = %w[Hr. Fr. Dr. Prof.].freeze
|
13
13
|
|
14
14
|
def name(gender = :any)
|
15
15
|
generate_name(first_name(gender))
|
@@ -29,7 +29,7 @@ module FFaker
|
|
29
29
|
|
30
30
|
def first_name(gender = :any)
|
31
31
|
case gender
|
32
|
-
when :any then rand(
|
32
|
+
when :any then rand(0..1) == 0 ? first_name(:male) : first_name(:female)
|
33
33
|
when :male then fetch_sample(MALE_FIRST_NAMES)
|
34
34
|
when :female then fetch_sample(FEMALE_FIRST_NAMES)
|
35
35
|
else
|
@@ -48,7 +48,7 @@ module FFaker
|
|
48
48
|
private
|
49
49
|
|
50
50
|
def generate_name(first_name)
|
51
|
-
case rand(
|
51
|
+
case rand(0..7)
|
52
52
|
when 0 then "#{prefix} #{first_name} #{last_name}"
|
53
53
|
when 1..2 then "#{first_name} #{last_name} #{last_name}"
|
54
54
|
else "#{first_name} #{last_name}"
|