Module: FFaker::PhoneNumberTW
Constant Summary
collapse
- HOME_PHONE_PREFIXES =
%w[02 03 04 05 06 07 08].freeze
- MOBILE_PHONE_PREFIX =
'09'
Instance Method Summary
collapse
const_missing, k, luhn_check, underscore, unique
#fetch_sample, #rand, #shuffle
Instance Method Details
#contry_code ⇒ Object
29
30
31
|
# File 'lib/ffaker/phone_number_tw.rb', line 29
def contry_code
'+886'
end
|
#home_work_phone_number ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/ffaker/phone_number_tw.rb', line 15
def home_work_phone_number
prefix = fetch_sample(HOME_PHONE_PREFIXES)
case prefix
when '02', '04'
FFaker.numerify("(#{prefix}) ####-####")
else
FFaker.numerify("(#{prefix}) ###-####")
end
end
|
#international_home_work_phone_number ⇒ Object
39
40
41
42
43
|
# File 'lib/ffaker/phone_number_tw.rb', line 39
def international_home_work_phone_number
number = home_work_phone_number
number[0..4] = "#{contry_code}-#{number[2]}-"
number
end
|
#international_mobile_phone_number ⇒ Object
33
34
35
36
37
|
# File 'lib/ffaker/phone_number_tw.rb', line 33
def international_mobile_phone_number
number = mobile_phone_number
number[0] = "#{contry_code}-"
number
end
|
#international_phone_number ⇒ Object
45
46
47
|
# File 'lib/ffaker/phone_number_tw.rb', line 45
def international_phone_number
rand(0..1).zero? ? international_mobile_phone_number : international_home_work_phone_number
end
|
#mobile_phone_number ⇒ Object
#phone_number ⇒ Object
11
12
13
|
# File 'lib/ffaker/phone_number_tw.rb', line 11
def phone_number
rand(0..1).zero? ? home_work_phone_number : mobile_phone_number
end
|