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, underscore

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#home_phone_numberObject



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

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

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

#international_home_phone_numberObject



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

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

#international_mobile_phone_numberObject



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

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

#international_phone_numberObject



36
37
38
# File 'lib/ffaker/phone_number_id.rb', line 36

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

#mobile_phone_numberObject



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

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

#phone_numberObject



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

def phone_number
  case rand(2)
  when 0 then home_phone_number
  when 1 then mobile_phone_number
  end
end