Module: FFaker::PhoneNumberDE
Instance Method Summary
collapse
const_missing, k, luhn_check, underscore, unique
#fetch_sample, #rand, #shuffle
Instance Method Details
#country_code ⇒ Object
34
35
36
|
# File 'lib/ffaker/phone_number_de.rb', line 34
def country_code
'+49'
end
|
#home_work_phone_number(leading_zero = true) ⇒ Object
30
31
32
|
# File 'lib/ffaker/phone_number_de.rb', line 30
def home_work_phone_number(leading_zero = true)
[region_prefix(leading_zero), FFaker.numerify('#######')].join(' ')
end
|
#international_home_work_phone_number ⇒ Object
42
43
44
|
# File 'lib/ffaker/phone_number_de.rb', line 42
def international_home_work_phone_number
[country_code, home_work_phone_number(false)].join(' ')
end
|
#international_mobile_phone_number ⇒ Object
38
39
40
|
# File 'lib/ffaker/phone_number_de.rb', line 38
def international_mobile_phone_number
[country_code, mobile_phone_number(false)].join(' ')
end
|
#international_phone_number ⇒ Object
46
47
48
|
# File 'lib/ffaker/phone_number_de.rb', line 46
def international_phone_number
international_home_work_phone_number
end
|
#mobile_phone_number(leading_zero = true) ⇒ Object
26
27
28
|
# File 'lib/ffaker/phone_number_de.rb', line 26
def mobile_phone_number(leading_zero = true)
[mobile_prefix(leading_zero), FFaker.numerify('#######')].join(' ')
end
|
#mobile_prefix(leading_zero = true) ⇒ Object
Mobile prefixes are in the 015x, 016x, 017x ranges
9
10
11
12
13
|
# File 'lib/ffaker/phone_number_de.rb', line 9
def mobile_prefix(leading_zero = true)
mobile_prefix = "1#{rand(5..7)}#{rand(0..9)}"
mobile_prefix = "0#{mobile_prefix}" if leading_zero
mobile_prefix
end
|
#phone_number ⇒ Object
22
23
24
|
# File 'lib/ffaker/phone_number_de.rb', line 22
def phone_number
home_work_phone_number
end
|
#region_prefix(leading_zero = true) ⇒ Object
Region prefixes are in range 02..09 with length of 3 to 5 digits
16
17
18
19
20
|
# File 'lib/ffaker/phone_number_de.rb', line 16
def region_prefix(leading_zero = true)
region_prefix = rand(2..9).to_s + FFaker.numerify('#' * rand(1..3)).to_s
region_prefix = "0#{region_prefix}" if leading_zero
region_prefix
end
|