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
data/lib/ffaker/lorem_ar.rb
CHANGED
@@ -7,11 +7,11 @@ module FFaker
|
|
7
7
|
extend self
|
8
8
|
|
9
9
|
def word
|
10
|
-
WORDS
|
10
|
+
fetch_sample(WORDS)
|
11
11
|
end
|
12
12
|
|
13
13
|
def words(num = 3)
|
14
|
-
WORDS
|
14
|
+
fetch_sample(WORDS, count: num)
|
15
15
|
end
|
16
16
|
|
17
17
|
def sentence(word_count = 4)
|
@@ -21,13 +21,13 @@ module FFaker
|
|
21
21
|
"#{s}."
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
alias phrase sentence
|
25
25
|
|
26
26
|
def sentences(sentence_count = 3)
|
27
27
|
(1..sentence_count).map { sentence }
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
alias phrases sentences
|
31
31
|
|
32
32
|
def paragraph(sentence_count = 3)
|
33
33
|
sentences(sentence_count + rand(3)).join(' ')
|
data/lib/ffaker/lorem_cn.rb
CHANGED
@@ -7,11 +7,11 @@ module FFaker
|
|
7
7
|
extend self
|
8
8
|
|
9
9
|
def word
|
10
|
-
WORDS
|
10
|
+
fetch_sample(WORDS)
|
11
11
|
end
|
12
12
|
|
13
13
|
def words(num = 3)
|
14
|
-
WORDS
|
14
|
+
fetch_sample(WORDS, count: num)
|
15
15
|
end
|
16
16
|
|
17
17
|
def sentence(word_count = 4)
|
@@ -23,7 +23,7 @@ module FFaker
|
|
23
23
|
def sentences(sentence_count = 3)
|
24
24
|
s = (1..sentence_count).map { sentence }
|
25
25
|
def s.to_s
|
26
|
-
result =
|
26
|
+
result = join(' ')
|
27
27
|
result[-1] = '。'
|
28
28
|
result
|
29
29
|
end
|
data/lib/ffaker/lorem_fr.rb
CHANGED
@@ -6,11 +6,11 @@ module FFaker
|
|
6
6
|
extend self
|
7
7
|
|
8
8
|
def word
|
9
|
-
WORDS
|
9
|
+
fetch_sample(WORDS)
|
10
10
|
end
|
11
11
|
|
12
12
|
def words(num = 3)
|
13
|
-
WORDS
|
13
|
+
fetch_sample(WORDS, count: num)
|
14
14
|
end
|
15
15
|
|
16
16
|
def sentence(word_count = 4)
|
@@ -20,13 +20,13 @@ module FFaker
|
|
20
20
|
"#{s}."
|
21
21
|
end
|
22
22
|
|
23
|
-
|
23
|
+
alias phrase sentence
|
24
24
|
|
25
25
|
def sentences(sentence_count = 3)
|
26
26
|
(1..sentence_count).map { sentence }
|
27
27
|
end
|
28
28
|
|
29
|
-
|
29
|
+
alias phrases sentences
|
30
30
|
|
31
31
|
def paragraph(sentence_count = 3)
|
32
32
|
sentences(sentence_count + rand(3)).join(' ')
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module FFaker
|
4
|
+
module LoremJA
|
5
|
+
extend ModuleUtils
|
6
|
+
extend self
|
7
|
+
|
8
|
+
def character
|
9
|
+
fetch_sample(CHARACTERS)
|
10
|
+
end
|
11
|
+
|
12
|
+
def characters(count = 20)
|
13
|
+
fetch_sample(CHARACTERS, count: count).join
|
14
|
+
end
|
15
|
+
|
16
|
+
def word
|
17
|
+
fetch_sample(WORDS)
|
18
|
+
end
|
19
|
+
|
20
|
+
def words(count = 3)
|
21
|
+
fetch_sample(WORDS, count: count)
|
22
|
+
end
|
23
|
+
|
24
|
+
def sentence
|
25
|
+
fetch_sample(SENTENCES)
|
26
|
+
end
|
27
|
+
|
28
|
+
def sentences(count = 3)
|
29
|
+
(1..count).map { fetch_sample(SENTENCES) }
|
30
|
+
end
|
31
|
+
|
32
|
+
def paragraph(sentence_count = 3)
|
33
|
+
sentences(sentence_count).join('、') + '、' + fetch_sample(SENTENCES_END) + '。'
|
34
|
+
end
|
35
|
+
|
36
|
+
def paragraphs(count = 3)
|
37
|
+
(1..count).map { paragraph }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/ffaker/lorem_kr.rb
CHANGED
@@ -6,24 +6,24 @@ module FFaker
|
|
6
6
|
extend self
|
7
7
|
|
8
8
|
def word
|
9
|
-
WORDS
|
9
|
+
fetch_sample(WORDS)
|
10
10
|
end
|
11
11
|
|
12
12
|
def words(num = 3)
|
13
|
-
WORDS
|
13
|
+
fetch_sample(WORDS, count: num)
|
14
14
|
end
|
15
15
|
|
16
16
|
def sentence(word_count = 4)
|
17
17
|
"#{words(word_count + rand(5) + 1).join(' ')}."
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
alias phrase sentence
|
21
21
|
|
22
22
|
def sentences(sentence_count = 3)
|
23
23
|
(1..sentence_count).map { sentence }
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
alias phrases sentences
|
27
27
|
|
28
28
|
def paragraph(sentence_count = 3)
|
29
29
|
sentences(sentence_count + rand(3)).join(' ')
|
data/lib/ffaker/lorem_ua.rb
CHANGED
@@ -6,29 +6,27 @@ module FFaker
|
|
6
6
|
extend self
|
7
7
|
|
8
8
|
def word
|
9
|
-
WORDS
|
9
|
+
fetch_sample(WORDS)
|
10
10
|
end
|
11
11
|
|
12
12
|
def words(num = 3)
|
13
|
-
WORDS
|
13
|
+
fetch_sample(WORDS, count: num)
|
14
14
|
end
|
15
15
|
|
16
16
|
def sentence(word_count = 7)
|
17
17
|
elements = words(word_count + rand(10))
|
18
|
-
if elements.count > 10
|
19
|
-
elements.insert(rand(3..(elements.count - 3)), ',')
|
20
|
-
end
|
18
|
+
elements.insert(rand(3..(elements.count - 3)), ',') if elements.count > 10
|
21
19
|
result = elements.join(' ').gsub(' , ', ', ')
|
22
20
|
capitalize_ukrainian("#{result}#{sentence_type_mark}")
|
23
21
|
end
|
24
22
|
|
25
|
-
|
23
|
+
alias phrase sentence
|
26
24
|
|
27
25
|
def sentences(sentence_count = 3)
|
28
26
|
(1..sentence_count).map { sentence }
|
29
27
|
end
|
30
28
|
|
31
|
-
|
29
|
+
alias phrases sentences
|
32
30
|
|
33
31
|
def paragraph(sentence_count = 5)
|
34
32
|
sentences(sentence_count + rand(3)).join(' ')
|
@@ -42,9 +40,9 @@ module FFaker
|
|
42
40
|
|
43
41
|
def sentence_type_mark
|
44
42
|
case rand(10)
|
45
|
-
when 0..7 then
|
46
|
-
when 8 then
|
47
|
-
when 9 then
|
43
|
+
when 0..7 then '.'
|
44
|
+
when 8 then '!'
|
45
|
+
when 9 then '?'
|
48
46
|
end
|
49
47
|
end
|
50
48
|
|
@@ -56,4 +54,3 @@ module FFaker
|
|
56
54
|
end
|
57
55
|
end
|
58
56
|
end
|
59
|
-
|
data/lib/ffaker/movie.rb
CHANGED
@@ -6,12 +6,12 @@ module FFaker
|
|
6
6
|
extend self
|
7
7
|
|
8
8
|
SUFFIXES = [
|
9
|
-
|
10
|
-
|
11
|
-
]
|
12
|
-
COLORS = %w
|
9
|
+
'from Hell', 'from Outer Space', 'from Mars', 'from the Black Lagoon', 'with a Thousand Faces',
|
10
|
+
'from Across the Ocean', 'Who Fell to Earth', 'That Came to Dinner'
|
11
|
+
].freeze
|
12
|
+
COLORS = %w(Red Yellow Black White).freeze
|
13
13
|
|
14
|
-
RATINGS = %w(G PG PG-13 R NC-17)
|
14
|
+
RATINGS = %w(G PG PG-13 R NC-17).freeze # According to MPAA
|
15
15
|
|
16
16
|
def title
|
17
17
|
case rand(4)
|
@@ -23,45 +23,43 @@ module FFaker
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def rating
|
26
|
-
RATINGS
|
26
|
+
fetch_sample(RATINGS)
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def title_with_prefix
|
32
|
-
"#{PREFIXES
|
32
|
+
"#{fetch_sample(PREFIXES)} #{maybe_adj_or_adv}#{fetch_sample(NOUNS)}"
|
33
33
|
end
|
34
34
|
|
35
35
|
def title_with_suffix
|
36
|
-
"The #{maybe_adj_or_adv}#{NOUNS
|
36
|
+
"The #{maybe_adj_or_adv}#{fetch_sample(NOUNS)} #{fetch_sample(SUFFIXES)}"
|
37
37
|
end
|
38
38
|
|
39
39
|
def maybe_adj_or_adv
|
40
|
-
if rand(2) == 1
|
41
|
-
ADJ_AND_ADV.sample + " "
|
42
|
-
end
|
40
|
+
fetch_sample(ADJ_AND_ADV) + ' ' if rand(2) == 1
|
43
41
|
end
|
44
42
|
|
45
43
|
def simple_title
|
46
|
-
"#{ADJ_AND_ADV
|
44
|
+
"#{fetch_sample(ADJ_AND_ADV)} #{fetch_sample(NOUNS)}"
|
47
45
|
end
|
48
46
|
|
49
47
|
def title_from_formula
|
50
48
|
case rand(13)
|
51
|
-
when 0 then "#{NOUNS
|
52
|
-
when 1 then "The #{NOUNS
|
53
|
-
when 2 then "The #{NOUNS
|
49
|
+
when 0 then "#{fetch_sample(NOUNS)} 2: Electric Boogaloo"
|
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"
|
54
52
|
when 3 then "#{simple_title}: The #{FFaker::Name.name} Story"
|
55
53
|
when 4 then "When #{FFaker::Name.first_name} Met #{FFaker::Name.first_name}"
|
56
|
-
when 5 then "Dr. #{NOUNS
|
54
|
+
when 5 then "Dr. #{fetch_sample(NOUNS)}"
|
57
55
|
when 6 then "Je Vous Presente, #{FFaker::Name.first_name}"
|
58
56
|
when 7 then "#{rand(3000)} A.D."
|
59
|
-
when 8 then "The #{NOUNS
|
57
|
+
when 8 then "The #{fetch_sample(NOUNS)} from #{FFaker::Address.neighborhood}"
|
60
58
|
when 9 then "Christmas on #{FFaker::Address.street_name}"
|
61
|
-
when 10 then "The #{COLORS
|
62
|
-
when 11 then "Hard Boiled #{NOUNS
|
59
|
+
when 10 then "The #{fetch_sample(COLORS)} Rose of #{FFaker::AddressUK.country}"
|
60
|
+
when 11 then "Hard Boiled #{fetch_sample(NOUNS)}"
|
63
61
|
else
|
64
|
-
::String.new.tap{|s| n = simple_title; s.replace("#{n} 2: Son of #{n}")}
|
62
|
+
::String.new.tap { |s| n = simple_title; s.replace("#{n} 2: Son of #{n}") }
|
65
63
|
end
|
66
64
|
end
|
67
65
|
end
|
data/lib/ffaker/music.rb
CHANGED
@@ -6,19 +6,19 @@ module FFaker
|
|
6
6
|
extend self
|
7
7
|
|
8
8
|
def genre
|
9
|
-
GENRES
|
9
|
+
fetch_sample(GENRES)
|
10
10
|
end
|
11
11
|
|
12
12
|
def album
|
13
|
-
ALBUMS
|
13
|
+
fetch_sample(ALBUMS)
|
14
14
|
end
|
15
15
|
|
16
16
|
def artist
|
17
|
-
ARTISTS
|
17
|
+
fetch_sample(ARTISTS)
|
18
18
|
end
|
19
19
|
|
20
20
|
def song
|
21
|
-
SONGS
|
21
|
+
fetch_sample(SONGS)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
data/lib/ffaker/name.rb
CHANGED
@@ -5,31 +5,120 @@ module FFaker
|
|
5
5
|
extend ModuleUtils
|
6
6
|
extend self
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
MALE_PREFIXES = %w(Mr.).freeze
|
9
|
+
FEMALE_PREFIXES = %w(Mrs. Miss.).freeze
|
10
|
+
OTHER_PREFIXES = %w(Ms. Dr.).freeze
|
11
|
+
PREFIXES = (MALE_PREFIXES + FEMALE_PREFIXES + OTHER_PREFIXES).freeze
|
12
|
+
FIRST_NAMES = (FIRST_NAMES_FEMALE + FIRST_NAMES_MALE).freeze
|
13
|
+
SUFFIXES = %w(Jr. Sr. I II III IV V MD DDS PhD DVM).freeze
|
10
14
|
|
11
15
|
def name
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
"#{first_name} #{last_name}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def html_safe_name
|
20
|
+
"#{first_name} #{html_safe_last_name}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def name_with_prefix
|
24
|
+
fetch_sample(
|
25
|
+
[
|
26
|
+
female_name_with_prefix,
|
27
|
+
male_name_with_prefix
|
28
|
+
]
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def name_with_suffix
|
33
|
+
fetch_sample(
|
34
|
+
[
|
35
|
+
female_name_with_suffix,
|
36
|
+
male_name_with_suffix
|
37
|
+
]
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
def name_with_prefix_suffix
|
42
|
+
fetch_sample(
|
43
|
+
[
|
44
|
+
female_name_with_prefix_suffix,
|
45
|
+
male_name_with_prefix_suffix
|
46
|
+
]
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
def female_name_with_prefix
|
51
|
+
"#{female_prefix} #{first_name_female} #{last_name}"
|
52
|
+
end
|
53
|
+
|
54
|
+
def male_name_with_prefix
|
55
|
+
"#{male_prefix} #{first_name_male} #{last_name}"
|
56
|
+
end
|
57
|
+
|
58
|
+
def female_name_with_suffix
|
59
|
+
"#{first_name_female} #{last_name} #{suffix}"
|
60
|
+
end
|
61
|
+
|
62
|
+
def male_name_with_suffix
|
63
|
+
"#{first_name_male} #{last_name} #{suffix}"
|
64
|
+
end
|
65
|
+
|
66
|
+
def female_name_with_prefix_suffix
|
67
|
+
"#{female_prefix} #{first_name_female} #{last_name} #{suffix}"
|
68
|
+
end
|
69
|
+
|
70
|
+
def male_name_with_prefix_suffix
|
71
|
+
"#{male_prefix} #{first_name_male} #{last_name} #{suffix}"
|
17
72
|
end
|
18
73
|
|
19
74
|
def first_name
|
20
|
-
FIRST_NAMES
|
75
|
+
fetch_sample(FIRST_NAMES)
|
76
|
+
end
|
77
|
+
|
78
|
+
def first_name_female
|
79
|
+
fetch_sample(FIRST_NAMES_FEMALE)
|
80
|
+
end
|
81
|
+
|
82
|
+
def first_name_male
|
83
|
+
fetch_sample(FIRST_NAMES_MALE)
|
21
84
|
end
|
22
85
|
|
23
86
|
def last_name
|
24
|
-
LAST_NAMES
|
87
|
+
fetch_sample(LAST_NAMES)
|
88
|
+
end
|
89
|
+
|
90
|
+
def html_safe_last_name
|
91
|
+
loop do
|
92
|
+
t = LAST_NAMES.sample
|
93
|
+
return t unless t.include? "'"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def html_safe_last_name
|
98
|
+
loop do
|
99
|
+
t = LAST_NAMES.sample
|
100
|
+
return t unless t.include? "'"
|
101
|
+
end
|
25
102
|
end
|
26
103
|
|
27
104
|
def prefix
|
28
|
-
PREFIXES
|
105
|
+
fetch_sample(PREFIXES)
|
106
|
+
end
|
107
|
+
|
108
|
+
def female_prefix
|
109
|
+
fetch_sample(FEMALE_PREFIXES)
|
110
|
+
end
|
111
|
+
|
112
|
+
def male_prefix
|
113
|
+
fetch_sample(MALE_PREFIXES)
|
114
|
+
end
|
115
|
+
|
116
|
+
def other_prefix
|
117
|
+
fetch_sample(OTHER_PREFIXES)
|
29
118
|
end
|
30
119
|
|
31
120
|
def suffix
|
32
|
-
SUFFIXES
|
121
|
+
fetch_sample(SUFFIXES)
|
33
122
|
end
|
34
123
|
end
|
35
124
|
end
|
data/lib/ffaker/name_br.rb
CHANGED
@@ -5,27 +5,58 @@ module FFaker
|
|
5
5
|
extend ModuleUtils
|
6
6
|
extend self
|
7
7
|
|
8
|
-
|
8
|
+
MALE_PREFIXES = %w(Sr.).freeze
|
9
|
+
FEMALE_PREFIXES = %w(Sra. Srta.).freeze
|
10
|
+
PREFIXES = (MALE_PREFIXES + FEMALE_PREFIXES).freeze
|
11
|
+
FIRST_NAMES = (FIRST_NAMES_FEMALE + FIRST_NAMES_MALE).freeze
|
9
12
|
|
10
13
|
def name
|
11
14
|
"#{first_name} #{last_name}"
|
12
15
|
end
|
13
16
|
|
14
17
|
def name_with_prefix
|
15
|
-
|
18
|
+
fetch_sample(
|
19
|
+
[
|
20
|
+
female_name_with_prefix,
|
21
|
+
male_name_with_prefix
|
22
|
+
]
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
def female_name_with_prefix
|
27
|
+
"#{female_prefix} #{first_name_female} #{last_name}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def male_name_with_prefix
|
31
|
+
"#{male_prefix} #{first_name_male} #{last_name}"
|
16
32
|
end
|
17
33
|
|
18
34
|
def first_name
|
19
|
-
FIRST_NAMES
|
35
|
+
fetch_sample(FIRST_NAMES)
|
36
|
+
end
|
37
|
+
|
38
|
+
def first_name_female
|
39
|
+
fetch_sample(FIRST_NAMES_FEMALE)
|
40
|
+
end
|
41
|
+
|
42
|
+
def first_name_male
|
43
|
+
fetch_sample(FIRST_NAMES_MALE)
|
20
44
|
end
|
21
45
|
|
22
46
|
def last_name
|
23
|
-
LAST_NAMES
|
47
|
+
fetch_sample(LAST_NAMES)
|
24
48
|
end
|
25
49
|
|
26
50
|
def prefix
|
27
|
-
PREFIXES
|
51
|
+
fetch_sample(PREFIXES)
|
52
|
+
end
|
53
|
+
|
54
|
+
def female_prefix
|
55
|
+
fetch_sample(FEMALE_PREFIXES)
|
56
|
+
end
|
57
|
+
|
58
|
+
def male_prefix
|
59
|
+
fetch_sample(MALE_PREFIXES)
|
28
60
|
end
|
29
61
|
end
|
30
62
|
end
|
31
|
-
|