Module: Faker::PhoneNumberSE
Overview
Constant Summary
collapse
- PHONE_FORMAT_PREFIX_2 =
k ["%s-### ### ##",
"%s-### ## ##",
"%s-## ## ##"]
- PHONE_FORMAT_PREFIX_3 =
k ["%s-### ## ##",
"%s-## ## ##",
"%s-## ###"]
- PHONE_FORMAT_PREFIX_4 =
k ["%s-## ## ##",
"%s-### ##"]
- MOBILE_PHONE_FORMAT =
k ["%s#-## ## ##", "%s#-######"]
- COUNTRY_PREFIX =
k ["+46", "0046"]
- MOBILE_PHONE_PREFIX =
k %w(70 72 73 76 74)
Instance Method Summary
collapse
const_missing, k, underscore
Instance Method Details
#area_prefix ⇒ Object
56
57
58
|
# File 'lib/ffakerer/phone_number_se.rb', line 56
def area_prefix
PHONE_PREFIX.rand
end
|
#country_prefix ⇒ Object
44
45
46
|
# File 'lib/ffakerer/phone_number_se.rb', line 44
def country_prefix
COUNTRY_PREFIX.rand
end
|
#home_work_phone_number ⇒ Object
29
30
31
|
# File 'lib/ffakerer/phone_number_se.rb', line 29
def home_work_phone_number
Faker.numerify("0#{phone_number_format}")
end
|
#international_home_work_phone_number ⇒ Object
52
53
54
|
# File 'lib/ffakerer/phone_number_se.rb', line 52
def international_home_work_phone_number
Faker.numerify("#{country_prefix} (0)#{phone_number_format}")
end
|
#international_mobile_phone_number ⇒ Object
48
49
50
|
# File 'lib/ffakerer/phone_number_se.rb', line 48
def international_mobile_phone_number
Faker.numerify("#{country_prefix} (0)#{mobile_phone_number_format}")
end
|
#international_phone_number ⇒ Object
37
38
39
40
41
42
|
# File 'lib/ffakerer/phone_number_se.rb', line 37
def international_phone_number
case rand(2)
when 0 then international_mobile_phone_number
when 1 then international_home_work_phone_number
end
end
|
#mobile_phone_number ⇒ Object
33
34
35
|
# File 'lib/ffakerer/phone_number_se.rb', line 33
def mobile_phone_number
Faker.numerify("0#{mobile_phone_number_format}")
end
|
73
74
75
|
# File 'lib/ffakerer/phone_number_se.rb', line 73
def mobile_phone_number_format
MOBILE_PHONE_FORMAT.rand % mobile_prefix
end
|
#mobile_prefix ⇒ Object
69
70
71
|
# File 'lib/ffakerer/phone_number_se.rb', line 69
def mobile_prefix
MOBILE_PHONE_PREFIX.rand
end
|
#phone_number ⇒ Object
22
23
24
25
26
27
|
# File 'lib/ffakerer/phone_number_se.rb', line 22
def phone_number
case rand(2)
when 0 then home_work_phone_number
when 1 then mobile_phone_number
end
end
|