Module: FFaker::PhoneNumberNL

Extended by:
ModuleUtils, PhoneNumberNL
Included in:
PhoneNumberNL
Defined in:
lib/ffaker/phone_number_nl.rb

Constant Summary collapse

COUNTRY_CODE =
'+31'
AREA_CODE_PREFIX =
'0'
PHONE_NUMBER =
{
  2 => ['#######', '### ####', '#### ###'],
  3 => ['######', '#### ##', '## ## ##']
}.freeze
MOBILE_PHONE_NUMBER =
['########', ' ## ## ## ##', ' ### ### ##', ' #### ####'].freeze

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, luhn_check, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#home_work_phone_numberObject



22
23
24
25
# File 'lib/ffaker/phone_number_nl.rb', line 22

def home_work_phone_number
  area = fetch_sample(AREA_CODES)
  FFaker.numerify "#{AREA_CODE_PREFIX}#{area}-#{fetch_sample(PHONE_NUMBER[area.size])}"
end

#international_home_work_phone_numberObject



37
38
39
40
# File 'lib/ffaker/phone_number_nl.rb', line 37

def international_home_work_phone_number
  area = fetch_sample(AREA_CODES)
  FFaker.numerify("#{COUNTRY_CODE} #{area}-#{fetch_sample(PHONE_NUMBER[area.size])}")
end

#international_mobile_phone_numberObject



42
43
44
# File 'lib/ffaker/phone_number_nl.rb', line 42

def international_mobile_phone_number
  FFaker.numerify("#{COUNTRY_CODE} 6#{fetch_sample(MOBILE_PHONE_NUMBER)}")
end

#international_phone_numberObject



31
32
33
34
35
# File 'lib/ffaker/phone_number_nl.rb', line 31

def international_phone_number
  return international_mobile_phone_number if rand(0..1).zero?

  international_home_work_phone_number
end

#mobile_phone_numberObject



27
28
29
# File 'lib/ffaker/phone_number_nl.rb', line 27

def mobile_phone_number
  FFaker.numerify "#{AREA_CODE_PREFIX}6#{fetch_sample(MOBILE_PHONE_NUMBER)}"
end

#phone_numberObject



16
17
18
19
20
# File 'lib/ffaker/phone_number_nl.rb', line 16

def phone_number
  return home_work_phone_number if rand(0..1).zero?

  mobile_phone_number
end