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,10 +8,10 @@ module FFaker
|
|
8
8
|
extend self
|
9
9
|
|
10
10
|
# Mobile prefixes
|
11
|
-
MobileOperatorsPrefix = %w(04)
|
11
|
+
MobileOperatorsPrefix = %w(04).freeze
|
12
12
|
|
13
13
|
# Home or Work Operator prefixes
|
14
|
-
HomeWorkOperatorsPrefix = %w(02 03 05 07 08)
|
14
|
+
HomeWorkOperatorsPrefix = %w(02 03 05 07 08).freeze
|
15
15
|
|
16
16
|
OperatorsPrefix = MobileOperatorsPrefix + HomeWorkOperatorsPrefix
|
17
17
|
|
@@ -56,7 +56,7 @@ module FFaker
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def country_code
|
59
|
-
|
59
|
+
'+61'
|
60
60
|
end
|
61
61
|
|
62
62
|
def international_mobile_phone_number
|
@@ -8,11 +8,11 @@ module FFaker
|
|
8
8
|
extend ModuleUtils
|
9
9
|
extend self
|
10
10
|
|
11
|
-
COUNTRY_PREFIX = '+55'
|
12
|
-
AREA_CODE = %w
|
13
|
-
HOME_WORK_PHONE_PREFIX = %w
|
14
|
-
MOBILE_PHONE_PREFIX = %w
|
15
|
-
PHONE_NUMBER = %w
|
11
|
+
COUNTRY_PREFIX = '+55'.freeze
|
12
|
+
AREA_CODE = %w(1# 2# 3# 4# 5# 6# 7# 8# 9#).freeze
|
13
|
+
HOME_WORK_PHONE_PREFIX = %w(2 3 4 5).freeze
|
14
|
+
MOBILE_PHONE_PREFIX = %w(6 7 8 9 96 97 98 99).freeze
|
15
|
+
PHONE_NUMBER = %w(####### ###-####).freeze
|
16
16
|
|
17
17
|
# generate a random phone number
|
18
18
|
#
|
@@ -53,15 +53,16 @@ module FFaker
|
|
53
53
|
end
|
54
54
|
|
55
55
|
private
|
56
|
+
|
56
57
|
def number(prefixes, country_prefix = '')
|
57
58
|
space = random_space
|
58
59
|
p = [
|
59
60
|
country_prefix,
|
60
61
|
space,
|
61
|
-
AREA_CODE
|
62
|
+
fetch_sample(AREA_CODE),
|
62
63
|
space,
|
63
|
-
prefixes
|
64
|
-
PHONE_NUMBER
|
64
|
+
fetch_sample(prefixes),
|
65
|
+
fetch_sample(PHONE_NUMBER)
|
65
66
|
].join('').strip
|
66
67
|
|
67
68
|
FFaker.numerify p
|
@@ -5,13 +5,13 @@ module FFaker
|
|
5
5
|
extend ModuleUtils
|
6
6
|
extend self
|
7
7
|
|
8
|
-
COUNTRY_PREFIX = %w
|
9
|
-
AREA_PREFIX = %w
|
10
|
-
MOBILE_PREFIX = %w
|
11
|
-
FREE_PHONE_PREFIX = %w
|
12
|
-
SHARED_COST_PREFIX = %w
|
13
|
-
PREMIUM_RATE_PREFIX = %w
|
14
|
-
PHONE_NUMBER = ['#######', ' ### ## ##']
|
8
|
+
COUNTRY_PREFIX = %w(+41 0041 0).freeze
|
9
|
+
AREA_PREFIX = %w(21 22 24 26 27 31 32 33 34 41 43 44 51 52 56 58 61 62 71 81 91).freeze
|
10
|
+
MOBILE_PREFIX = %w(74 75 76 77 78 79).freeze
|
11
|
+
FREE_PHONE_PREFIX = %w(800).freeze
|
12
|
+
SHARED_COST_PREFIX = %w(840 842 844 848).freeze
|
13
|
+
PREMIUM_RATE_PREFIX = %w(900 901 906).freeze
|
14
|
+
PHONE_NUMBER = ['#######', ' ### ## ##'].freeze
|
15
15
|
|
16
16
|
def phone_number
|
17
17
|
case rand(5)
|
@@ -6,10 +6,10 @@ module FFaker
|
|
6
6
|
extend self
|
7
7
|
|
8
8
|
# Mobile prefixes
|
9
|
-
MobileOperatorsPrefix = %w(05)
|
9
|
+
MobileOperatorsPrefix = %w(05).freeze
|
10
10
|
|
11
11
|
# Home or Work Operator prefixes
|
12
|
-
HomeWorkOperatorsPrefix = %w(021 022 023 024 031 032 033 041 042 043 045 046 047 048 07)
|
12
|
+
HomeWorkOperatorsPrefix = %w(021 022 023 024 031 032 033 041 042 043 045 046 047 048 07).freeze
|
13
13
|
|
14
14
|
OperatorsPrefix = MobileOperatorsPrefix + HomeWorkOperatorsPrefix
|
15
15
|
|
@@ -81,7 +81,7 @@ module FFaker
|
|
81
81
|
phone_prefix = home_work_phone_prefix
|
82
82
|
case phone_prefix.size
|
83
83
|
when 2 then FFaker.numerify("#{international_country_code}#{phone_prefix[1]} ### ####")
|
84
|
-
when 3 then FFaker.numerify("#{international_country_code}#{phone_prefix[1,2]} ## ####")
|
84
|
+
when 3 then FFaker.numerify("#{international_country_code}#{phone_prefix[1, 2]} ## ####")
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
@@ -96,7 +96,7 @@ module FFaker
|
|
96
96
|
# Based on information from http://en.wikipedia.org/wiki/E.164
|
97
97
|
#
|
98
98
|
def e164_country_code
|
99
|
-
|
99
|
+
'53'
|
100
100
|
end
|
101
101
|
|
102
102
|
def e164_mobile_phone_number
|
@@ -107,7 +107,7 @@ module FFaker
|
|
107
107
|
phone_prefix = home_work_phone_prefix
|
108
108
|
case phone_prefix.size
|
109
109
|
when 2 then FFaker.numerify("#{e164_country_code}#{phone_prefix[1]}#######")
|
110
|
-
when 3 then FFaker.numerify("#{e164_country_code}#{phone_prefix[1,2]}######")
|
110
|
+
when 3 then FFaker.numerify("#{e164_country_code}#{phone_prefix[1, 2]}######")
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
@@ -15,7 +15,7 @@ module FFaker
|
|
15
15
|
|
16
16
|
# Region prefixes are in range 02..09 with length of 3 to 5 digits
|
17
17
|
def region_prefix(leading_zero = true)
|
18
|
-
region_prefix = (rand(8) + 2).to_s + FFaker.numerify(
|
18
|
+
region_prefix = (rand(8) + 2).to_s + FFaker.numerify('#' * (rand(3) + 1)).to_s
|
19
19
|
region_prefix = '0' + region_prefix if leading_zero
|
20
20
|
region_prefix
|
21
21
|
end
|
@@ -5,10 +5,10 @@ module FFaker
|
|
5
5
|
extend ModuleUtils
|
6
6
|
extend self
|
7
7
|
|
8
|
-
COUNTRY_PREFIX = %w
|
9
|
-
AREA_PREFIX = %w
|
10
|
-
MOBILE_PREFIX = %w
|
11
|
-
PHONE_NUMBER = ['########', ' ## ## ## ##']
|
8
|
+
COUNTRY_PREFIX = %w(+33 0033 0).freeze
|
9
|
+
AREA_PREFIX = %w(1 2 3 4 5).freeze
|
10
|
+
MOBILE_PREFIX = %w(6 7).freeze
|
11
|
+
PHONE_NUMBER = ['########', ' ## ## ## ##'].freeze
|
12
12
|
|
13
13
|
def phone_number
|
14
14
|
case rand(2)
|
@@ -5,8 +5,8 @@ module FFaker
|
|
5
5
|
extend ModuleUtils
|
6
6
|
extend self
|
7
7
|
|
8
|
-
COUNTRY_PREFIX = ['+39', '0039', '+39 ', '0039 ']
|
9
|
-
PHONE_NUMBER = ['######', '########']
|
8
|
+
COUNTRY_PREFIX = ['+39', '0039', '+39 ', '0039 '].freeze
|
9
|
+
PHONE_NUMBER = ['######', '########'].freeze
|
10
10
|
|
11
11
|
def phone_number
|
12
12
|
if rand(0..1) == 1
|
@@ -6,8 +6,8 @@ module FFaker
|
|
6
6
|
extend self
|
7
7
|
|
8
8
|
HOME_PHONE_PREFIXES =
|
9
|
-
%w(02 031 032 033 041 042 043 044 049 051 052 053 054 055 061 062 063 064)
|
10
|
-
MOBILE_PHONE_PREFIXES = %w(010 011 016 019)
|
9
|
+
%w(02 031 032 033 041 042 043 044 049 051 052 053 054 055 061 062 063 064).freeze
|
10
|
+
MOBILE_PHONE_PREFIXES = %w(010 011 016 019).freeze
|
11
11
|
|
12
12
|
def phone_number
|
13
13
|
case rand(2)
|
@@ -17,11 +17,11 @@ module FFaker
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def home_work_phone_number
|
20
|
-
FFaker.numerify("#{HOME_PHONE_PREFIXES
|
20
|
+
FFaker.numerify("#{fetch_sample(HOME_PHONE_PREFIXES)} #### ####")
|
21
21
|
end
|
22
22
|
|
23
23
|
def mobile_phone_number
|
24
|
-
FFaker.numerify("#{MOBILE_PHONE_PREFIXES
|
24
|
+
FFaker.numerify("#{fetch_sample(MOBILE_PHONE_PREFIXES)} #### ####")
|
25
25
|
end
|
26
26
|
|
27
27
|
def contry_code
|
@@ -10,14 +10,14 @@ module FFaker
|
|
10
10
|
# xx xxxx xxxx
|
11
11
|
#
|
12
12
|
def home_work_phone_number
|
13
|
-
FFaker.numerify(
|
13
|
+
FFaker.numerify('## #### ####')
|
14
14
|
end
|
15
15
|
|
16
16
|
# Generates a mobile phone number
|
17
17
|
# 044 xx xxxx xxxx
|
18
18
|
#
|
19
19
|
def mobile_phone_number
|
20
|
-
FFaker.numerify(
|
20
|
+
FFaker.numerify('044 ## #### ####')
|
21
21
|
end
|
22
22
|
|
23
23
|
# generates mobile or home/work number
|
@@ -29,7 +29,7 @@ module FFaker
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def country_code
|
32
|
-
|
32
|
+
'+52'
|
33
33
|
end
|
34
34
|
|
35
35
|
def international_mobile_phone_number
|
@@ -51,8 +51,7 @@ module FFaker
|
|
51
51
|
# 01 800 xxx xxxx
|
52
52
|
#
|
53
53
|
def toll_free_number
|
54
|
-
FFaker.numerify(
|
54
|
+
FFaker.numerify('01 800 ### ####')
|
55
55
|
end
|
56
|
-
|
57
56
|
end
|
58
57
|
end
|
@@ -5,14 +5,14 @@ module FFaker
|
|
5
5
|
extend ModuleUtils
|
6
6
|
extend self
|
7
7
|
|
8
|
-
COUNTRY_CODE =
|
9
|
-
AREA_CODE_PREFIX =
|
8
|
+
COUNTRY_CODE = '+31'.freeze
|
9
|
+
AREA_CODE_PREFIX = '0'.freeze
|
10
10
|
PHONE_NUMBER = {
|
11
|
-
2 => [
|
12
|
-
3 => [
|
13
|
-
}
|
14
|
-
AREA_CODES = %w(10 111 113 114 115 117 118 13 14 15 161 162 164 165 166 167 168 172 174 180 181 182 183 184 186 187 20 222 223 224 226 227 228 229 23 24 251 252 255 26 294 297 299 30 313 314 315 316 317 318 320 321 33 341 342 343 344 345 346 347 348 35 36 38 40 411 412 413 416 418 43 45 46 475 478 481 485 486 487 488 492 493 495 497 499 50 511 512 513 514 515 516 517 518 519 521 522 523 524 525 527 528 529 53 541 543 544 545 546 547 548 55 561 562 566 570 571 572 573 575 577 578 58 591 592 593 594 595 596 597 598 599 70 71 72 73 74 75 76 77 78 79)
|
15
|
-
MOBILE_PHONE_NUMBER = ['########', ' ## ## ## ##', ' ### ### ##',
|
11
|
+
2 => ['#######', '### ####', '#### ###'],
|
12
|
+
3 => ['######', '#### ##', '## ## ##']
|
13
|
+
}.freeze
|
14
|
+
AREA_CODES = %w(10 111 113 114 115 117 118 13 14 15 161 162 164 165 166 167 168 172 174 180 181 182 183 184 186 187 20 222 223 224 226 227 228 229 23 24 251 252 255 26 294 297 299 30 313 314 315 316 317 318 320 321 33 341 342 343 344 345 346 347 348 35 36 38 40 411 412 413 416 418 43 45 46 475 478 481 485 486 487 488 492 493 495 497 499 50 511 512 513 514 515 516 517 518 519 521 522 523 524 525 527 528 529 53 541 543 544 545 546 547 548 55 561 562 566 570 571 572 573 575 577 578 58 591 592 593 594 595 596 597 598 599 70 71 72 73 74 75 76 77 78 79).freeze
|
15
|
+
MOBILE_PHONE_NUMBER = ['########', ' ## ## ## ##', ' ### ### ##', ' #### ####'].freeze
|
16
16
|
|
17
17
|
def phone_number
|
18
18
|
case rand(2)
|
@@ -22,12 +22,12 @@ module FFaker
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def home_work_phone_number
|
25
|
-
area = AREA_CODES
|
26
|
-
FFaker.numerify "#{AREA_CODE_PREFIX}#{area}-#{PHONE_NUMBER[area.size]
|
25
|
+
area = fetch_sample(AREA_CODES)
|
26
|
+
FFaker.numerify "#{AREA_CODE_PREFIX}#{area}-#{fetch_sample(PHONE_NUMBER[area.size])}"
|
27
27
|
end
|
28
28
|
|
29
29
|
def mobile_phone_number
|
30
|
-
FFaker.numerify "#{AREA_CODE_PREFIX}6#{MOBILE_PHONE_NUMBER
|
30
|
+
FFaker.numerify "#{AREA_CODE_PREFIX}6#{fetch_sample(MOBILE_PHONE_NUMBER)}"
|
31
31
|
end
|
32
32
|
|
33
33
|
def international_phone_number
|
@@ -38,12 +38,12 @@ module FFaker
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def international_home_work_phone_number
|
41
|
-
area = AREA_CODES
|
42
|
-
FFaker.numerify("#{COUNTRY_CODE} #{area}-#{PHONE_NUMBER[area.size]
|
41
|
+
area = fetch_sample(AREA_CODES)
|
42
|
+
FFaker.numerify("#{COUNTRY_CODE} #{area}-#{fetch_sample(PHONE_NUMBER[area.size])}")
|
43
43
|
end
|
44
44
|
|
45
45
|
def international_mobile_phone_number
|
46
|
-
FFaker.numerify("#{COUNTRY_CODE} 6#{MOBILE_PHONE_NUMBER
|
46
|
+
FFaker.numerify("#{COUNTRY_CODE} 6#{fetch_sample(MOBILE_PHONE_NUMBER)}")
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module FFaker
|
4
|
-
|
5
4
|
# Format for swedish numbers, from here
|
6
5
|
# from http://sv.wikipedia.org/wiki/Telefonnummer
|
7
6
|
#
|
@@ -19,17 +18,17 @@ module FFaker
|
|
19
18
|
extend ModuleUtils
|
20
19
|
extend self
|
21
20
|
|
22
|
-
PHONE_FORMAT_PREFIX_2 = [
|
23
|
-
|
24
|
-
|
25
|
-
PHONE_FORMAT_PREFIX_3 = [
|
26
|
-
|
27
|
-
|
28
|
-
PHONE_FORMAT_PREFIX_4 = [
|
29
|
-
|
30
|
-
MOBILE_PHONE_FORMAT = [
|
31
|
-
COUNTRY_PREFIX = [
|
32
|
-
MOBILE_PHONE_PREFIX = %w(70 72 73 76 74)
|
21
|
+
PHONE_FORMAT_PREFIX_2 = ['%s-### ### ##',
|
22
|
+
'%s-### ## ##',
|
23
|
+
'%s-## ## ##'].freeze
|
24
|
+
PHONE_FORMAT_PREFIX_3 = ['%s-### ## ##',
|
25
|
+
'%s-## ## ##',
|
26
|
+
'%s-## ###'].freeze
|
27
|
+
PHONE_FORMAT_PREFIX_4 = ['%s-## ## ##',
|
28
|
+
'%s-### ##'].freeze
|
29
|
+
MOBILE_PHONE_FORMAT = ['%s#-## ## ##', '%s#-######'].freeze
|
30
|
+
COUNTRY_PREFIX = ['+46', '0046'].freeze
|
31
|
+
MOBILE_PHONE_PREFIX = %w(70 72 73 76 74).freeze
|
33
32
|
|
34
33
|
def phone_number
|
35
34
|
case rand(2)
|
@@ -54,7 +53,7 @@ module FFaker
|
|
54
53
|
end
|
55
54
|
|
56
55
|
def country_prefix
|
57
|
-
COUNTRY_PREFIX
|
56
|
+
fetch_sample(COUNTRY_PREFIX)
|
58
57
|
end
|
59
58
|
|
60
59
|
def international_mobile_phone_number
|
@@ -66,24 +65,24 @@ module FFaker
|
|
66
65
|
end
|
67
66
|
|
68
67
|
def area_prefix
|
69
|
-
PHONE_PREFIX
|
68
|
+
fetch_sample(PHONE_PREFIX)
|
70
69
|
end
|
71
70
|
|
72
71
|
def phone_number_format
|
73
72
|
prefix = area_prefix
|
74
73
|
case prefix.length
|
75
|
-
when 1 then PHONE_FORMAT_PREFIX_2
|
76
|
-
when 2 then PHONE_FORMAT_PREFIX_3
|
77
|
-
when 3 then PHONE_FORMAT_PREFIX_4
|
74
|
+
when 1 then fetch_sample(PHONE_FORMAT_PREFIX_2)
|
75
|
+
when 2 then fetch_sample(PHONE_FORMAT_PREFIX_3)
|
76
|
+
when 3 then fetch_sample(PHONE_FORMAT_PREFIX_4)
|
78
77
|
end % prefix
|
79
78
|
end
|
80
79
|
|
81
80
|
def mobile_prefix
|
82
|
-
MOBILE_PHONE_PREFIX
|
81
|
+
fetch_sample(MOBILE_PHONE_PREFIX)
|
83
82
|
end
|
84
83
|
|
85
84
|
def mobile_phone_number_format
|
86
|
-
MOBILE_PHONE_FORMAT
|
85
|
+
fetch_sample(MOBILE_PHONE_FORMAT) % mobile_prefix
|
87
86
|
end
|
88
87
|
end
|
89
88
|
end
|
@@ -20,49 +20,49 @@ module FFaker
|
|
20
20
|
# 3xxx xxxx
|
21
21
|
#
|
22
22
|
def voip_number
|
23
|
-
FFaker.numerify(
|
23
|
+
FFaker.numerify('3### ####')
|
24
24
|
end
|
25
25
|
|
26
26
|
# Generates a fixed line phone number
|
27
27
|
# 6xxx xxxx
|
28
28
|
#
|
29
29
|
def fixed_line_number
|
30
|
-
FFaker.numerify(
|
30
|
+
FFaker.numerify('6### ####')
|
31
31
|
end
|
32
32
|
|
33
33
|
# Generates a fixed mobile phone number
|
34
34
|
# 8xxx xxxx
|
35
35
|
#
|
36
36
|
def mobile_number
|
37
|
-
FFaker.numerify(
|
37
|
+
FFaker.numerify('8### ####')
|
38
38
|
end
|
39
39
|
|
40
40
|
# Generates a fixed mobile phone number or pager service number
|
41
41
|
# 9xxx xxxx
|
42
42
|
#
|
43
43
|
def mobile_or_pager_number
|
44
|
-
FFaker.numerify(
|
44
|
+
FFaker.numerify('9### ####')
|
45
45
|
end
|
46
46
|
|
47
47
|
# Generates an international toll-free number
|
48
48
|
# 800 xxx xxxx
|
49
49
|
#
|
50
50
|
def international_toll_free_number
|
51
|
-
FFaker.numerify(
|
51
|
+
FFaker.numerify('800 ### ####')
|
52
52
|
end
|
53
53
|
|
54
54
|
# Generates an toll-free number
|
55
55
|
# 1800 xxx xxxx
|
56
56
|
#
|
57
57
|
def toll_free_number
|
58
|
-
FFaker.numerify(
|
58
|
+
FFaker.numerify('1800 ### ####')
|
59
59
|
end
|
60
60
|
|
61
61
|
# Generates a premium service number
|
62
62
|
# (1900) xxx xxxx
|
63
63
|
#
|
64
64
|
def premium_service_number
|
65
|
-
FFaker.numerify(
|
65
|
+
FFaker.numerify('1900 ### ####')
|
66
66
|
end
|
67
67
|
|
68
68
|
# generates mobile or home/work number
|
@@ -75,7 +75,7 @@ module FFaker
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def country_code
|
78
|
-
|
78
|
+
'+65'
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
@@ -12,13 +12,13 @@ module FFaker
|
|
12
12
|
# 76 => Tigo
|
13
13
|
# 70 => Expresso
|
14
14
|
#
|
15
|
-
MobileOperatorsPrefix = %w(70 76 77)
|
15
|
+
MobileOperatorsPrefix = %w(70 76 77).freeze
|
16
16
|
|
17
17
|
# Home or Work Operator prefixes
|
18
18
|
#
|
19
19
|
# 33 => Orange
|
20
20
|
#
|
21
|
-
HomeWorkOperatorsPrefix = %w(33)
|
21
|
+
HomeWorkOperatorsPrefix = %w(33).freeze
|
22
22
|
|
23
23
|
# Return a prefix in MobileOperatorsPrefix
|
24
24
|
# @see FFaker::PhoneNumberSN::MobileOperatorsPrefix
|
data/lib/ffaker/product.rb
CHANGED
@@ -5,24 +5,28 @@ module FFaker
|
|
5
5
|
extend ModuleUtils
|
6
6
|
extend self
|
7
7
|
|
8
|
-
B2
|
9
|
-
VOWELS = %w(a e i o u ou ie y io)
|
10
|
-
START = %w(tr br p ph)
|
11
|
-
SUFFIX = %w(ck ns nce nt st ne re ffe ph)
|
12
|
-
ADDON = %w(wood forge func)
|
8
|
+
B2 = %w(nix cell sync func balt sche pod).freeze
|
9
|
+
VOWELS = %w(a e i o u ou ie y io).freeze
|
10
|
+
START = %w(tr br p ph).freeze
|
11
|
+
SUFFIX = %w(ck ns nce nt st ne re ffe ph).freeze
|
12
|
+
ADDON = %w(wood forge func).freeze
|
13
13
|
|
14
14
|
def brand
|
15
15
|
case rand(12)
|
16
|
-
when (0..4) then B1
|
17
|
-
when (5..10) then
|
18
|
-
|
16
|
+
when (0..4) then fetch_sample(B1) + fetch_sample(B2)
|
17
|
+
when (5..10) then
|
18
|
+
[
|
19
|
+
fetch_sample(START), fetch_sample(VOWELS), fetch_sample(SUFFIX),
|
20
|
+
rand(2).zero? ? fetch_sample(ADDON) : nil
|
21
|
+
].join.capitalize
|
22
|
+
when 11 then letters(2..3).to_s
|
19
23
|
end
|
20
24
|
end
|
21
25
|
|
22
26
|
def product_name
|
23
27
|
case rand(2)
|
24
|
-
when 0 then "#{ADJ
|
25
|
-
when 1 then "#{[ADJ
|
28
|
+
when 0 then "#{fetch_sample(ADJ)} #{fetch_sample(NOUN)}"
|
29
|
+
when 1 then "#{[fetch_sample(ADJ), fetch_sample(ADJ)].uniq.join(' ')} #{fetch_sample(NOUN)}"
|
26
30
|
end
|
27
31
|
end
|
28
32
|
|
@@ -31,14 +35,14 @@ module FFaker
|
|
31
35
|
end
|
32
36
|
|
33
37
|
def letters(n)
|
34
|
-
max = n.is_a?(Range) ? n.to_a
|
35
|
-
(0...max).map { LETTERS.
|
38
|
+
max = n.is_a?(Range) ? fetch_sample(n.to_a) : n
|
39
|
+
(0...max).map { fetch_sample(LETTERS).upcase }.join
|
36
40
|
end
|
37
41
|
|
38
42
|
def model
|
39
43
|
case rand(2)
|
40
|
-
when 0 then "#{LETTERS.
|
41
|
-
when 1 then "#{letters(1..rand(1..2))}-#{rand(9900)}"
|
44
|
+
when 0 then "#{fetch_sample(LETTERS).upcase}#{rand(90)}" # N90
|
45
|
+
when 1 then "#{letters(1..rand(1..2))}-#{rand(9900)}" # N-9400
|
42
46
|
end
|
43
47
|
end
|
44
48
|
end
|