ffaker 2.2.0 → 2.3.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 +34 -0
- data/README.md +4 -0
- data/REFERENCE.md +1153 -800
- data/Rakefile +23 -24
- data/ffaker.gemspec +12 -420
- data/lib/ffaker.rb +47 -7
- data/lib/ffaker/address.rb +11 -11
- data/lib/ffaker/address_au.rb +60 -60
- data/lib/ffaker/address_br.rb +5 -5
- data/lib/ffaker/address_ca.rb +7 -7
- data/lib/ffaker/address_ch.rb +1 -2
- data/lib/ffaker/address_ch_de.rb +1 -1
- data/lib/ffaker/address_ch_fr.rb +1 -1
- data/lib/ffaker/address_ch_it.rb +1 -1
- data/lib/ffaker/address_da.rb +5 -5
- data/lib/ffaker/address_de.rb +16 -12
- data/lib/ffaker/address_fi.rb +7 -8
- data/lib/ffaker/address_fr.rb +13 -13
- data/lib/ffaker/address_gr.rb +40 -0
- data/lib/ffaker/address_in.rb +12 -12
- data/lib/ffaker/address_kr.rb +87 -0
- data/lib/ffaker/address_mx.rb +409 -409
- data/lib/ffaker/address_nl.rb +17 -13
- data/lib/ffaker/address_ru.rb +6 -6
- data/lib/ffaker/address_se.rb +7 -8
- data/lib/ffaker/address_sn.rb +3 -3
- data/lib/ffaker/address_ua.rb +8 -8
- data/lib/ffaker/address_uk.rb +5 -5
- data/lib/ffaker/address_us.rb +9 -9
- data/lib/ffaker/airline.rb +16 -0
- data/lib/ffaker/avatar.rb +3 -3
- data/lib/ffaker/aws.rb +24 -0
- data/lib/ffaker/bacon_ipsum.rb +2 -2
- data/lib/ffaker/book.rb +45 -0
- data/lib/ffaker/boolean.rb +2 -2
- data/lib/ffaker/cheesy_lingo.rb +15 -12
- data/lib/ffaker/color.rb +54 -1
- data/lib/ffaker/color_ua.rb +1 -1
- data/lib/ffaker/company.rb +13 -11
- data/lib/ffaker/company_cn.rb +23 -0
- data/lib/ffaker/company_it.rb +4 -4
- data/lib/ffaker/company_se.rb +2 -2
- data/lib/ffaker/conference.rb +1 -1
- data/lib/ffaker/courses.rb +2 -3
- data/lib/ffaker/currency.rb +2 -2
- data/lib/ffaker/data/address_gr/city +79 -0
- data/lib/ffaker/data/address_gr/region +13 -0
- data/lib/ffaker/data/address_gr/street +100 -0
- data/lib/ffaker/data/address_kr/boroughs +29 -0
- data/lib/ffaker/data/address_kr/cities +51 -0
- data/lib/ffaker/data/airline/codes_list +209 -0
- data/lib/ffaker/data/airline/names_list +206 -0
- data/lib/ffaker/data/aws/ec2_instance_type +59 -0
- data/lib/ffaker/data/aws/ec2_reserved_instance_tenancy +3 -0
- data/lib/ffaker/data/aws/ec2_reserved_offering_type +6 -0
- data/lib/ffaker/data/aws/ec2_reserved_product_description +14 -0
- data/lib/ffaker/data/book/adj_and_adv +20 -0
- data/lib/ffaker/data/book/genres +369 -0
- data/lib/ffaker/data/book/nouns +36 -0
- data/lib/ffaker/data/book/prefixes +17 -0
- data/lib/ffaker/data/color/names_list +128 -0
- data/lib/ffaker/data/education/degree_prefix +274 -0
- data/lib/ffaker/data/education/degree_short_prefix +19 -0
- data/lib/ffaker/data/job_br/job_nouns +52 -0
- data/lib/ffaker/data/job_vn/job_nouns +191 -0
- data/lib/ffaker/data/lorem_ja/characters +101 -0
- data/lib/ffaker/data/lorem_ja/sentences +30 -0
- data/lib/ffaker/data/lorem_ja/sentences_end +21 -0
- data/lib/ffaker/data/lorem_ja/words +81 -0
- data/lib/ffaker/data/name/first_names_female +4275 -0
- data/lib/ffaker/data/name/first_names_male +1219 -0
- data/lib/ffaker/data/name_br/first_names_female +1068 -0
- data/lib/ffaker/data/name_br/first_names_male +607 -0
- data/lib/ffaker/data/name_br/last_names +52 -0
- data/lib/ffaker/data/name_gr/female_first_names +80 -0
- data/lib/ffaker/data/name_gr/female_last_names +45 -0
- data/lib/ffaker/data/name_gr/male_first_names +90 -0
- data/lib/ffaker/data/name_gr/male_last_names +57 -0
- data/lib/ffaker/data/name_kh/first_names +64 -0
- data/lib/ffaker/data/name_kh/last_names +71 -0
- data/lib/ffaker/data/name_kh/nick_names +30 -0
- data/lib/ffaker/data/name_then/first_names +292 -0
- data/lib/ffaker/data/name_then/last_names +63 -0
- data/lib/ffaker/data/name_then/nick_names +30 -0
- data/lib/ffaker/data/phone_number/phone_calling_code +205 -0
- data/lib/ffaker/data/sport/names +57 -24
- data/lib/ffaker/data/tweet/hashtag +58 -0
- data/lib/ffaker/data/youtube/video_ids +50 -0
- data/lib/ffaker/dizzle_ipsum.rb +2 -2
- data/lib/ffaker/education.rb +17 -16
- data/lib/ffaker/food.rb +5 -6
- data/lib/ffaker/gender.rb +4 -4
- data/lib/ffaker/gender_br.rb +17 -0
- data/lib/ffaker/gender_cn.rb +4 -4
- data/lib/ffaker/gender_kr.rb +4 -4
- data/lib/ffaker/geolocation.rb +26 -26
- data/lib/ffaker/healthcare_ipsum.rb +2 -2
- data/lib/ffaker/hipster_ipsum.rb +2 -2
- data/lib/ffaker/html_ipsum.rb +101 -81
- data/lib/ffaker/identification.rb +4 -4
- data/lib/ffaker/identification_br.rb +84 -0
- data/lib/ffaker/identification_es.rb +2 -2
- data/lib/ffaker/identification_es_cl.rb +7 -5
- data/lib/ffaker/identification_es_co.rb +9 -10
- data/lib/ffaker/identification_kr.rb +3 -4
- data/lib/ffaker/identification_mx.rb +27 -11
- data/lib/ffaker/internet.rb +26 -23
- data/lib/ffaker/internet_se.rb +21 -21
- data/lib/ffaker/job.rb +1 -1
- data/lib/ffaker/job_br.rb +12 -0
- data/lib/ffaker/job_cn.rb +1 -1
- data/lib/ffaker/job_fr.rb +3 -3
- data/lib/ffaker/job_ja.rb +2 -1
- data/lib/ffaker/job_kr.rb +1 -1
- data/lib/ffaker/job_vn.rb +13 -0
- data/lib/ffaker/locale.rb +2 -3
- data/lib/ffaker/lorem.rb +5 -5
- data/lib/ffaker/lorem_ar.rb +4 -4
- data/lib/ffaker/lorem_cn.rb +3 -3
- data/lib/ffaker/lorem_fr.rb +4 -4
- data/lib/ffaker/lorem_ja.rb +40 -0
- data/lib/ffaker/lorem_kr.rb +4 -4
- data/lib/ffaker/lorem_ua.rb +8 -11
- data/lib/ffaker/movie.rb +18 -20
- data/lib/ffaker/music.rb +4 -4
- data/lib/ffaker/name.rb +100 -11
- data/lib/ffaker/name_br.rb +37 -6
- data/lib/ffaker/name_cn.rb +2 -2
- data/lib/ffaker/name_cs.rb +10 -10
- data/lib/ffaker/name_da.rb +6 -6
- data/lib/ffaker/name_de.rb +5 -5
- data/lib/ffaker/name_fr.rb +4 -4
- data/lib/ffaker/name_ga.rb +4 -5
- data/lib/ffaker/name_gr.rb +60 -0
- data/lib/ffaker/name_it.rb +4 -4
- data/lib/ffaker/name_ja.rb +3 -3
- data/lib/ffaker/name_kh.rb +22 -0
- data/lib/ffaker/name_kr.rb +3 -3
- data/lib/ffaker/name_mx.rb +14 -14
- data/lib/ffaker/name_nb.rb +5 -5
- data/lib/ffaker/name_nl.rb +7 -7
- data/lib/ffaker/name_ph.rb +2 -2
- data/lib/ffaker/name_ru.rb +7 -8
- data/lib/ffaker/name_se.rb +5 -5
- data/lib/ffaker/name_sn.rb +23 -23
- data/lib/ffaker/name_th.rb +3 -3
- data/lib/ffaker/name_th_en.rb +26 -0
- data/lib/ffaker/name_ua.rb +8 -8
- data/lib/ffaker/name_vn.rb +4 -4
- data/lib/ffaker/nato_alphabet.rb +10 -10
- data/lib/ffaker/phone_number.rb +31 -21
- data/lib/ffaker/phone_number_au.rb +3 -3
- data/lib/ffaker/phone_number_br.rb +9 -8
- data/lib/ffaker/phone_number_ch.rb +7 -7
- data/lib/ffaker/phone_number_cu.rb +5 -5
- data/lib/ffaker/phone_number_de.rb +1 -1
- data/lib/ffaker/phone_number_fr.rb +4 -4
- data/lib/ffaker/phone_number_it.rb +2 -2
- data/lib/ffaker/phone_number_kr.rb +4 -4
- data/lib/ffaker/phone_number_mx.rb +4 -5
- data/lib/ffaker/phone_number_nl.rb +13 -13
- data/lib/ffaker/phone_number_se.rb +18 -19
- data/lib/ffaker/phone_number_sg.rb +8 -8
- data/lib/ffaker/phone_number_sn.rb +2 -2
- data/lib/ffaker/product.rb +18 -14
- data/lib/ffaker/skill.rb +3 -3
- data/lib/ffaker/sport.rb +1 -1
- data/lib/ffaker/ssn_se.rb +19 -20
- data/lib/ffaker/string.rb +21 -23
- data/lib/ffaker/time.rb +19 -7
- data/lib/ffaker/tweet.rb +59 -0
- data/lib/ffaker/unit.rb +12 -12
- data/lib/ffaker/unit_english.rb +34 -35
- data/lib/ffaker/unit_metric.rb +25 -25
- data/lib/ffaker/utils/array_utils.rb +12 -9
- data/lib/ffaker/utils/module_utils.rb +9 -6
- data/lib/ffaker/utils/random_utils.rb +33 -0
- data/lib/ffaker/vehicle.rb +21 -21
- data/lib/ffaker/venue.rb +1 -1
- data/lib/ffaker/youtube.rb +24 -0
- data/scripts/benchmark.rb +3 -3
- data/scripts/reference.rb +26 -23
- data/test/helper.rb +50 -0
- data/test/test_address.rb +40 -21
- data/test/test_address_au.rb +19 -9
- data/test/test_address_br.rb +9 -2
- data/test/test_address_ca.rb +7 -0
- data/test/test_address_ch.rb +6 -2
- data/test/test_address_ch_de.rb +7 -3
- data/test/test_address_ch_fr.rb +7 -3
- data/test/test_address_ch_it.rb +5 -1
- data/test/test_address_da.rb +18 -9
- data/test/test_address_de.rb +12 -5
- data/test/test_address_fi.rb +10 -3
- data/test/test_address_fr.rb +13 -0
- data/test/test_address_gr.rb +43 -0
- data/test/test_address_in.rb +20 -12
- data/test/test_address_kr.rb +14 -0
- data/test/test_address_mx.rb +12 -5
- data/test/test_address_nl.rb +11 -5
- data/test/test_address_ru.rb +11 -5
- data/test/test_address_se.rb +9 -3
- data/test/test_address_sn.rb +7 -1
- data/test/test_address_ua.rb +17 -10
- data/test/test_address_uk.rb +11 -3
- data/test/test_address_us.rb +15 -6
- data/test/test_airline.rb +17 -0
- data/test/test_array_utils.rb +51 -3
- data/test/test_avatar.rb +5 -1
- data/test/test_aws.rb +25 -0
- data/test/test_bacon_ipsum.rb +12 -6
- data/test/test_book.rb +41 -0
- data/test/test_boolean.rb +4 -0
- data/test/test_cheesy_lingo.rb +14 -10
- data/test/test_color.rb +126 -1
- data/test/test_color_ua.rb +5 -1
- data/test/test_company.rb +7 -0
- data/test/test_company_cn.rb +24 -0
- data/test/test_company_it.rb +7 -1
- data/test/test_company_se.rb +6 -0
- data/test/test_conference.rb +5 -2
- data/test/test_course_mathematiques.rb +5 -1
- data/test/test_course_philosophie.rb +5 -1
- data/test/test_currency.rb +12 -0
- data/test/test_dizzle_ipsum.rb +12 -6
- data/test/test_education.rb +9 -2
- data/test/test_faker.rb +8 -1
- data/test/test_food.rb +11 -4
- data/test/test_gender.rb +5 -1
- data/test/test_gender_br.rb +18 -0
- data/test/test_gender_cn.rb +5 -2
- data/test/test_gender_kr.rb +7 -3
- data/test/test_geolocation.rb +11 -8
- data/test/test_guid.rb +6 -1
- data/test/test_healthcare_ipsum.rb +13 -6
- data/test/test_hipster_ipsum.rb +13 -6
- data/test/test_html_ipsum.rb +28 -20
- data/test/test_identification.rb +9 -2
- data/test/test_identification_br.rb +46 -0
- data/test/test_identification_co.rb +7 -0
- data/test/test_identification_es.rb +5 -1
- data/test/test_identification_es_cl.rb +5 -1
- data/test/test_identification_es_mx.rb +7 -2
- data/test/test_identification_kr.rb +4 -0
- data/test/test_internet.rb +36 -5
- data/test/test_internet_se.rb +12 -4
- data/test/test_job.rb +4 -0
- data/test/test_job_br.rb +17 -0
- data/test/test_job_cn.rb +4 -0
- data/test/test_job_fr.rb +4 -0
- data/test/test_job_ja.rb +4 -0
- data/test/test_job_kr.rb +4 -0
- data/test/test_job_vn.rb +22 -0
- data/test/test_locale.rb +10 -4
- data/test/test_lorem.rb +18 -11
- data/test/test_lorem_ar.rb +16 -8
- data/test/test_lorem_cn.rb +9 -2
- data/test/test_lorem_fr.rb +16 -8
- data/test/test_lorem_ja.rb +81 -0
- data/test/test_lorem_kr.rb +17 -8
- data/test/test_lorem_ua.rb +15 -8
- data/test/test_module_utils.rb +2 -2
- data/test/test_movie.rb +5 -1
- data/test/test_music.rb +11 -4
- data/test/test_name.rb +114 -1
- data/test/test_name_br.rb +41 -2
- data/test/test_name_cn.rb +7 -0
- data/test/test_name_cs.rb +7 -0
- data/test/test_name_da.rb +13 -6
- data/test/test_name_de.rb +4 -0
- data/test/test_name_fr.rb +7 -0
- data/test/test_name_ga.rb +7 -0
- data/test/test_name_gr.rb +70 -0
- data/test/test_name_it.rb +7 -0
- data/test/test_name_ja.rb +7 -0
- data/test/test_name_kh.rb +32 -0
- data/test/test_name_kr.rb +7 -0
- data/test/test_name_mx.rb +9 -0
- data/test/test_name_nb.rb +8 -0
- data/test/test_name_nl.rb +4 -0
- data/test/test_name_ph.rb +7 -0
- data/test/test_name_ru.rb +10 -3
- data/test/test_name_se.rb +12 -4
- data/test/test_name_sn.rb +8 -0
- data/test/test_name_th.rb +7 -0
- data/test/test_name_th_en.rb +35 -0
- data/test/test_name_ua.rb +26 -17
- data/test/test_name_vn.rb +42 -0
- data/test/test_nato_alphabet.rb +15 -4
- data/test/test_phone_number.rb +24 -6
- data/test/test_phone_number_au.rb +17 -6
- data/test/test_phone_number_br.rb +22 -13
- data/test/test_phone_number_cu.rb +29 -18
- data/test/test_phone_number_da.rb +16 -7
- data/test/test_phone_number_de.rb +17 -9
- data/test/test_phone_number_kr.rb +9 -0
- data/test/test_phone_number_mx.rb +16 -8
- data/test/test_phone_number_nl.rb +9 -2
- data/test/test_phone_number_se.rb +12 -7
- data/test/test_phone_number_sg.rb +17 -9
- data/test/test_phone_number_sn.rb +12 -4
- data/test/test_products.rb +22 -0
- data/test/test_skill.rb +8 -2
- data/test/test_sports.rb +4 -0
- data/test/test_ssn.rb +3 -1
- data/test/test_ssn_mx.rb +6 -1
- data/test/test_ssn_se.rb +3 -0
- data/test/test_string.rb +28 -1
- data/test/test_time.rb +33 -2
- data/test/test_tweet.rb +59 -0
- data/test/test_units.rb +7 -0
- data/test/test_units_english.rb +9 -0
- data/test/test_units_metric.rb +9 -0
- data/test/test_vehicle.rb +24 -15
- data/test/test_venue.rb +5 -1
- data/test/test_youtube.rb +28 -0
- metadata +101 -5
- data/lib/ffaker/data/name/first_names +0 -3008
- data/lib/ffaker/data/name_br/first_names +0 -91
@@ -8,13 +8,12 @@ module FFaker
|
|
8
8
|
# Resident Registration Number
|
9
9
|
# http://ko.wikipedia.org/wiki/%EC%A3%BC%EB%AF%BC%EB%93%B1%EB%A1%9D%EB%B2%88%ED%98%B8
|
10
10
|
def rrn
|
11
|
-
birth = [*Date.new(1970, 1, 1)..Date.new(1999, 12, 31)].
|
12
|
-
sex = [1, 2]
|
13
|
-
loc = FFaker.numerify("#{[*
|
11
|
+
birth = fetch_sample([*Date.new(1970, 1, 1)..Date.new(1999, 12, 31)]).strftime('%y%d%m')
|
12
|
+
sex = fetch_sample([1, 2])
|
13
|
+
loc = FFaker.numerify("#{fetch_sample([*'00'..'95'])}###")
|
14
14
|
a, b, c, d, e, f, g, h, i, j, k, l = "#{birth}#{sex}#{loc}".split(//).map(&:to_i)
|
15
15
|
checksum = (11 - (2 * a + 3 * b + 4 * c + 5 * d + 6 * e + 7 * f + 8 * g + 9 * h + 2 * i + 3 * j + 4 * k + 5 * l) % 11) % 10
|
16
16
|
"#{birth}-#{sex}#{loc}#{checksum}"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
@@ -8,8 +8,8 @@ module FFaker
|
|
8
8
|
extend ModuleUtils
|
9
9
|
extend self
|
10
10
|
|
11
|
-
CONSONANTS =
|
12
|
-
VOWELS =
|
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)
|
@@ -17,32 +17,48 @@ module FFaker
|
|
17
17
|
def rfc_persona_fisica
|
18
18
|
consonants_n = CONSONANTS + ["Ñ"]
|
19
19
|
all_letters = consonants_n + VOWELS
|
20
|
-
date = ::Time.at(rand * ::Time.now.to_f).strftime(
|
21
|
-
|
20
|
+
date = ::Time.at(rand * ::Time.now.to_f).strftime('%y%m%d')
|
21
|
+
[
|
22
|
+
fetch_sample(consonants_n),
|
23
|
+
fetch_sample(VOWELS),
|
24
|
+
fetch_sample(all_letters, count: 2).join,
|
25
|
+
date,
|
26
|
+
fetch_sample(HOMOCLAVE, count: 3).join
|
27
|
+
].join
|
22
28
|
end
|
23
29
|
|
24
30
|
# http://es.wikipedia.org/wiki/Registro_Federal_de_Contribuyentes_(M%C3%A9xico)
|
25
31
|
# Registro Federal de Contribuyentes (R.F.C.) para persona moral
|
26
32
|
def rfc_persona_moral
|
27
|
-
consonants_n_amp = CONSONANTS + ["Ñ",
|
33
|
+
consonants_n_amp = CONSONANTS + ["Ñ", '&']
|
28
34
|
all_letters = consonants_n_amp + VOWELS
|
29
|
-
date = ::Time.at(rand * ::Time.now.to_f).strftime(
|
30
|
-
"#{all_letters
|
35
|
+
date = ::Time.at(rand * ::Time.now.to_f).strftime('%y%m%d')
|
36
|
+
"#{fetch_sample(all_letters, count: 3).join}#{date}#{fetch_sample(HOMOCLAVE, count: 3).join}"
|
31
37
|
end
|
32
38
|
|
33
39
|
# http://es.wikipedia.org/wiki/Registro_Federal_de_Contribuyentes_(M%C3%A9xico)
|
34
40
|
# Registro Federal de Contribuyentes (R.F.C.)
|
35
41
|
def rfc
|
36
|
-
[rfc_persona_moral, rfc_persona_fisica]
|
42
|
+
fetch_sample([rfc_persona_moral, rfc_persona_fisica])
|
37
43
|
end
|
38
44
|
|
39
45
|
# http://es.wikipedia.org/wiki/Clave_%C3%9Anica_de_Registro_de_Poblaci%C3%B3n
|
40
46
|
# Clave Única de Registro de Población
|
41
47
|
def curp
|
42
48
|
all_letters = CONSONANTS + VOWELS
|
43
|
-
hm =
|
44
|
-
date = ::Time.at(rand * ::Time.now.to_f).strftime(
|
45
|
-
|
49
|
+
hm = %w(H M)
|
50
|
+
date = ::Time.at(rand * ::Time.now.to_f).strftime('%y%m%d')
|
51
|
+
[
|
52
|
+
fetch_sample(CONSONANTS),
|
53
|
+
fetch_sample(VOWELS),
|
54
|
+
fetch_sample(all_letters, count: 2).join,
|
55
|
+
date,
|
56
|
+
fetch_sample(hm),
|
57
|
+
fetch_sample(ESTADOS_CURP),
|
58
|
+
fetch_sample(CONSONANTS, count: 3).join,
|
59
|
+
fetch_sample(HOMOCLAVE),
|
60
|
+
rand(10)
|
61
|
+
].join
|
46
62
|
end
|
47
63
|
end
|
48
64
|
end
|
data/lib/ffaker/internet.rb
CHANGED
@@ -5,43 +5,42 @@ module FFaker
|
|
5
5
|
extend ModuleUtils
|
6
6
|
extend self
|
7
7
|
|
8
|
-
BYTE = [*
|
9
|
-
HOSTS = %w(gmail.com yahoo.com hotmail.com)
|
10
|
-
DISPOSABLE_HOSTS = %w(mailinator.com suremail.info spamherelots.com binkmail.com safetymail.info)
|
11
|
-
DOMAIN_SUFFIXES = %w(co.uk com us ca biz info name)
|
12
|
-
SAFE_DOMAIN_SUFFIXES = %w
|
13
|
-
SLUG_DELIMITERS = %w
|
8
|
+
BYTE = [*'0'..'255'].freeze
|
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
|
+
MAC_LIMIT = 281_474_976_710_655
|
14
15
|
|
15
16
|
def email(name = nil)
|
16
|
-
[user_name(name), domain_name].join(
|
17
|
+
[user_name(name), domain_name].join('@')
|
17
18
|
end
|
18
19
|
|
19
20
|
# returns an email address of an online disposable email service (like tempinbox.com).
|
20
21
|
# you can really send an email to these addresses an access it by going to the service web pages.
|
21
22
|
def disposable_email(name = nil)
|
22
|
-
[user_name(name), DISPOSABLE_HOSTS
|
23
|
+
[user_name(name), fetch_sample(DISPOSABLE_HOSTS)].join('@')
|
23
24
|
end
|
24
25
|
|
25
26
|
def free_email(name = nil)
|
26
|
-
"#{user_name(name)}@#{HOSTS
|
27
|
+
"#{user_name(name)}@#{fetch_sample(HOSTS)}"
|
27
28
|
end
|
28
29
|
|
29
30
|
def safe_email(name = nil)
|
30
|
-
"#{user_name(name)}@example.#{SAFE_DOMAIN_SUFFIXES
|
31
|
+
"#{user_name(name)}@example.#{fetch_sample(SAFE_DOMAIN_SUFFIXES)}"
|
31
32
|
end
|
32
33
|
|
33
34
|
def user_name(name = nil)
|
34
35
|
if name
|
35
|
-
parts = name.scan(/\w+/).
|
36
|
+
parts = shuffle(name.scan(/\w+/)).join(fetch_sample(%w(. _)))
|
36
37
|
parts.downcase
|
37
38
|
else
|
38
39
|
case rand(2)
|
39
40
|
when 0
|
40
41
|
sanitize(Name.first_name)
|
41
42
|
when 1
|
42
|
-
[Name.first_name, Name.last_name].
|
43
|
-
map { |n| sanitize(n) }.
|
44
|
-
join(%w(. _).sample)
|
43
|
+
[Name.first_name, Name.last_name].map { |n| sanitize(n) }.join(fetch_sample(%w(. _)))
|
45
44
|
end
|
46
45
|
end
|
47
46
|
end
|
@@ -51,14 +50,14 @@ module FFaker
|
|
51
50
|
end
|
52
51
|
|
53
52
|
def domain_word
|
54
|
-
dw = Company.name.split(
|
55
|
-
dw.gsub!(/\W/,
|
53
|
+
dw = Company.name.split(' ').first
|
54
|
+
dw.gsub!(/\W/, '')
|
56
55
|
dw.downcase!
|
57
56
|
dw
|
58
57
|
end
|
59
58
|
|
60
59
|
def domain_suffix
|
61
|
-
DOMAIN_SUFFIXES
|
60
|
+
fetch_sample(DOMAIN_SUFFIXES)
|
62
61
|
end
|
63
62
|
|
64
63
|
def uri(protocol)
|
@@ -66,29 +65,33 @@ module FFaker
|
|
66
65
|
end
|
67
66
|
|
68
67
|
def http_url
|
69
|
-
uri(
|
68
|
+
uri('http')
|
70
69
|
end
|
71
70
|
|
72
71
|
def ip_v4_address
|
73
|
-
(1..4).map { BYTE
|
72
|
+
(1..4).map { fetch_sample(BYTE) }.join('.')
|
74
73
|
end
|
75
74
|
|
76
75
|
def slug(words = nil, glue = nil)
|
77
|
-
words ||= Lorem.words(2).join(
|
78
|
-
glue ||= SLUG_DELIMITERS
|
76
|
+
words ||= Lorem.words(2).join(' ')
|
77
|
+
glue ||= fetch_sample(SLUG_DELIMITERS)
|
79
78
|
words.downcase.gsub(/[^a-z0-9]+/, glue)
|
80
79
|
end
|
81
80
|
|
82
81
|
def password(min_length = 8, max_length = 16)
|
83
82
|
length =
|
84
|
-
min_length > max_length ? min_length : [*min_length..max_length]
|
83
|
+
min_length > max_length ? min_length : fetch_sample([*min_length..max_length])
|
85
84
|
String.from_regexp(/[a-z]{#{length}}/)
|
86
85
|
end
|
87
86
|
|
87
|
+
def mac(delimiter = ':')
|
88
|
+
rand(MAC_LIMIT).to_s(16).rjust(12, '0').scan(/.{2}/).join(delimiter)
|
89
|
+
end
|
90
|
+
|
88
91
|
private
|
89
92
|
|
90
93
|
def sanitize(string)
|
91
|
-
string.gsub(/\W/,
|
94
|
+
string.gsub(/\W/, '').downcase
|
92
95
|
end
|
93
96
|
end
|
94
97
|
end
|
data/lib/ffaker/internet_se.rb
CHANGED
@@ -9,11 +9,11 @@ module FFaker
|
|
9
9
|
extend ModuleUtils
|
10
10
|
extend self
|
11
11
|
|
12
|
-
BYTE = [*'0'..'255']
|
13
|
-
HOSTS = %w(gmail.com yahoo.com hotmail.com spray.se passagen.se)
|
14
|
-
DOMAIN_SUFFIXES = %w(se nu com)
|
15
|
-
DISPOSABLE_HOSTS = %w(mailinator.com suremail.info spamherelots.com binkmail.com safetymail.info)
|
16
|
-
SLUG_DELIMITERS = %w
|
12
|
+
BYTE = [*'0'..'255'].freeze
|
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}"
|
@@ -23,16 +23,16 @@ module FFaker
|
|
23
23
|
# (like tempinbox.com). you can really send an email to these
|
24
24
|
# addresses an access it by going to the service web pages.
|
25
25
|
def disposable_email(name = nil)
|
26
|
-
"#{user_name(name)}@#{DISPOSABLE_HOSTS
|
26
|
+
"#{user_name(name)}@#{fetch_sample(DISPOSABLE_HOSTS)}"
|
27
27
|
end
|
28
28
|
|
29
29
|
def free_email(name = nil)
|
30
|
-
"#{user_name(name)}@#{HOSTS
|
30
|
+
"#{user_name(name)}@#{fetch_sample(HOSTS)}"
|
31
31
|
end
|
32
32
|
|
33
33
|
# Used to fake login names were dot is not allowed
|
34
34
|
def login_user_name
|
35
|
-
user_name.tr('.','')
|
35
|
+
user_name.tr('.', '')
|
36
36
|
end
|
37
37
|
|
38
38
|
# Mostly used for email creation
|
@@ -51,24 +51,24 @@ module FFaker
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def user_name_variant_long
|
54
|
-
array_parts = [
|
55
|
-
array_parts.map!{ |word| word.gsub(/\W/, '') }
|
54
|
+
array_parts = [NameSE.first_name, NameSE.last_name]
|
55
|
+
array_parts.map! { |word| word.gsub(/\W/, '') }
|
56
56
|
join_to_user_name(array_parts)
|
57
57
|
end
|
58
58
|
|
59
59
|
def user_name_variant_short
|
60
|
-
array_parts = [
|
61
|
-
array_parts.map!{ |word| word.gsub(/\W/, '') }
|
60
|
+
array_parts = [NameSE.first_name]
|
61
|
+
array_parts.map! { |word| word.gsub(/\W/, '') }
|
62
62
|
join_to_user_name(array_parts)
|
63
63
|
end
|
64
64
|
|
65
65
|
def user_name_from_name(name)
|
66
|
-
array_parts = name.scan(/\w+/)
|
66
|
+
array_parts = shuffle(name.scan(/\w+/))
|
67
67
|
join_to_user_name(array_parts)
|
68
68
|
end
|
69
69
|
|
70
70
|
def join_to_user_name(array_parts)
|
71
|
-
join_char = %w(. _)
|
71
|
+
join_char = fetch_sample(%w(. _))
|
72
72
|
array_parts.map(&:downcase).join(join_char)
|
73
73
|
end
|
74
74
|
|
@@ -77,10 +77,10 @@ module FFaker
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def domain_word
|
80
|
-
company_name_single_word.tap
|
80
|
+
company_name_single_word.tap do |dw|
|
81
81
|
dw.gsub!(/\W/, '')
|
82
82
|
dw.downcase!
|
83
|
-
|
83
|
+
end
|
84
84
|
end
|
85
85
|
|
86
86
|
def company_name_single_word
|
@@ -88,7 +88,7 @@ module FFaker
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def domain_suffix
|
91
|
-
DOMAIN_SUFFIXES
|
91
|
+
fetch_sample(DOMAIN_SUFFIXES)
|
92
92
|
end
|
93
93
|
|
94
94
|
def uri(protocol)
|
@@ -96,17 +96,17 @@ module FFaker
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def http_url
|
99
|
-
uri(
|
99
|
+
uri('http')
|
100
100
|
end
|
101
101
|
|
102
102
|
def ip_v4_address
|
103
|
-
(1..4).map { BYTE
|
103
|
+
(1..4).map { fetch_sample(BYTE) }.join('.')
|
104
104
|
end
|
105
105
|
|
106
106
|
def slug(words = nil, glue = nil)
|
107
|
-
glue ||= SLUG_DELIMITERS
|
107
|
+
glue ||= fetch_sample(SLUG_DELIMITERS)
|
108
108
|
|
109
|
-
(words || FFaker::Lorem
|
109
|
+
(words || FFaker::Lorem.words(2).join(' ')).gsub(' ', glue).downcase
|
110
110
|
end
|
111
111
|
end
|
112
112
|
end
|
data/lib/ffaker/job.rb
CHANGED
data/lib/ffaker/job_cn.rb
CHANGED
data/lib/ffaker/job_fr.rb
CHANGED
@@ -5,13 +5,13 @@ module FFaker
|
|
5
5
|
extend ModuleUtils
|
6
6
|
extend self
|
7
7
|
|
8
|
-
JOB_ADJECTIVES = %w(general adjoint associé)
|
8
|
+
JOB_ADJECTIVES = %w(general adjoint associé).freeze
|
9
9
|
|
10
10
|
def title
|
11
11
|
if rand(2).zero?
|
12
|
-
"#{JOB_PREFIXES
|
12
|
+
"#{fetch_sample(JOB_PREFIXES)} #{fetch_sample(JOB_ADJECTIVES)} #{fetch_sample(JOB_NOUNS)}"
|
13
13
|
else
|
14
|
-
"#{JOB_PREFIXES
|
14
|
+
"#{fetch_sample(JOB_PREFIXES)} #{fetch_sample(JOB_NOUNS)}"
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
data/lib/ffaker/job_ja.rb
CHANGED
data/lib/ffaker/job_kr.rb
CHANGED
data/lib/ffaker/locale.rb
CHANGED
@@ -10,7 +10,7 @@ module FFaker
|
|
10
10
|
if given_language && code_index
|
11
11
|
LANGUAGE_CODE[code_index]
|
12
12
|
else
|
13
|
-
LANGUAGE_CODE
|
13
|
+
fetch_sample(LANGUAGE_CODE)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -19,9 +19,8 @@ module FFaker
|
|
19
19
|
if given_code && language_index
|
20
20
|
LANGUAGE[language_index]
|
21
21
|
else
|
22
|
-
LANGUAGE
|
22
|
+
fetch_sample(LANGUAGE)
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
26
25
|
end
|
27
26
|
end
|
data/lib/ffaker/lorem.rb
CHANGED
@@ -7,15 +7,15 @@ module FFaker
|
|
7
7
|
extend self
|
8
8
|
|
9
9
|
def characters(character_count = 255)
|
10
|
-
Array.new(character_count < 0 ? 0 : character_count).map { CHARACTERS
|
10
|
+
Array.new(character_count < 0 ? 0 : character_count).map { fetch_sample(CHARACTERS) }.join
|
11
11
|
end
|
12
12
|
|
13
13
|
def word
|
14
|
-
WORDS
|
14
|
+
fetch_sample(WORDS)
|
15
15
|
end
|
16
16
|
|
17
17
|
def words(num = 3)
|
18
|
-
WORDS
|
18
|
+
fetch_sample(WORDS, count: num)
|
19
19
|
end
|
20
20
|
|
21
21
|
def sentence(word_count = 4)
|
@@ -27,13 +27,13 @@ module FFaker
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
alias phrase sentence
|
31
31
|
|
32
32
|
def sentences(sentence_count = 3)
|
33
33
|
(1..sentence_count).map { sentence }
|
34
34
|
end
|
35
35
|
|
36
|
-
|
36
|
+
alias phrases sentences
|
37
37
|
|
38
38
|
def paragraph(sentence_count = 3)
|
39
39
|
sentences(sentence_count + rand(3)).join(' ')
|