Module: FFaker::PhoneNumberKR

Extended by:
ModuleUtils, PhoneNumberKR
Included in:
PhoneNumberKR
Defined in:
lib/ffaker/phone_number_kr.rb

Constant Summary collapse

HOME_PHONE_PREFIXES =
%w(02 031 032 033 041 042 043 044 049 051 052 053 054 055 061 062 063 064)
MOBILE_PHONE_PREFIXES =
%w(010 011 016 019)

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore

Instance Method Details

#contry_codeObject



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

def contry_code
  '+82'
end

#home_work_phone_numberObject



19
20
21
# File 'lib/ffaker/phone_number_kr.rb', line 19

def home_work_phone_number
  FFaker.numerify("#{HOME_PHONE_PREFIXES.sample} #### ####")
end

#international_home_work_phone_numberObject



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

def international_home_work_phone_number
  number = home_work_phone_number
  number[0] = "#{contry_code} "
  number
end

#international_mobile_phone_numberObject



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

def international_mobile_phone_number
  number = mobile_phone_number
  number[0] = "#{contry_code} "
  number
end

#international_phone_numberObject



43
44
45
46
47
48
# File 'lib/ffaker/phone_number_kr.rb', line 43

def international_phone_number
  case rand(2)
  when 0 then international_mobile_phone_number
  when 1 then international_home_work_phone_number
  end
end

#mobile_phone_numberObject



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

def mobile_phone_number
  FFaker.numerify("#{MOBILE_PHONE_PREFIXES.sample} #### ####")
end

#phone_numberObject



12
13
14
15
16
17
# File 'lib/ffaker/phone_number_kr.rb', line 12

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