Module: FFaker::PhoneNumberID

Extended by:
ModuleUtils, PhoneNumberID
Included in:
PhoneNumberID
Defined in:
lib/ffaker/phone_number_id.rb

Constant Summary collapse

COUNTRY_CODE =
'+62'

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_phone_numberObject



14
15
16
17
18
# File 'lib/ffaker/phone_number_id.rb', line 14

def home_phone_number
  digit_nums = '#' * rand(7..8)

  "#{fetch_sample(HOME_PHONE_PREFIXES)}-#{FFaker.numerify(digit_nums)}"
end

#international_home_phone_numberObject



28
29
30
# File 'lib/ffaker/phone_number_id.rb', line 28

def international_home_phone_number
  home_phone_number.sub('0', COUNTRY_CODE)
end

#international_mobile_phone_numberObject



24
25
26
# File 'lib/ffaker/phone_number_id.rb', line 24

def international_mobile_phone_number
  mobile_phone_number.sub('0', COUNTRY_CODE)
end

#international_phone_numberObject



32
33
34
# File 'lib/ffaker/phone_number_id.rb', line 32

def international_phone_number
  phone_number.sub('0', COUNTRY_CODE)
end

#mobile_phone_numberObject



10
11
12
# File 'lib/ffaker/phone_number_id.rb', line 10

def mobile_phone_number
  "#{fetch_sample(MOBILE_PHONE_PREFIXES)}-#{FFaker.numerify('########')}"
end

#phone_numberObject



20
21
22
# File 'lib/ffaker/phone_number_id.rb', line 20

def phone_number
  rand(0..1).zero? ? home_phone_number : mobile_phone_number
end