module Faker::PhoneNumberSE
Format for swedish numbers, from here from sv.wikipedia.org/wiki/Telefonnummer
All area codes are from this list sv.wikipedia.org/wiki/Lista_%C3%B6ver_svenska_riktnummer
-
Length 9 08-xxx xxx xx, 0xx-xxx xx xx, 0xxx-xx xx xx
-
Length 8 08-xxx xx xx, 0xx-xx xx xx, 0xxx-xxx xx
-
Length 7 08-xx xx xx, 0xx-xxx xx
Constants
- COUNTRY_PREFIX
- MOBILE_PHONE_FORMAT
- MOBILE_PHONE_PREFIX
- PHONE_FORMAT_PREFIX_2
- PHONE_FORMAT_PREFIX_3
- PHONE_FORMAT_PREFIX_4
Public Instance Methods
area_prefix()
click to toggle source
# File lib/ffakerer/phone_number_se.rb, line 56 def area_prefix PHONE_PREFIX.rand end
country_prefix()
click to toggle source
# File lib/ffakerer/phone_number_se.rb, line 44 def country_prefix COUNTRY_PREFIX.rand end
home_work_phone_number()
click to toggle source
# File lib/ffakerer/phone_number_se.rb, line 29 def home_work_phone_number Faker.numerify("0#{phone_number_format}") end
international_home_work_phone_number()
click to toggle source
# File lib/ffakerer/phone_number_se.rb, line 52 def international_home_work_phone_number Faker.numerify("#{country_prefix} (0)#{phone_number_format}") end
international_mobile_phone_number()
click to toggle source
# File lib/ffakerer/phone_number_se.rb, line 48 def international_mobile_phone_number Faker.numerify("#{country_prefix} (0)#{mobile_phone_number_format}") end
international_phone_number()
click to toggle source
# File lib/ffakerer/phone_number_se.rb, line 37 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_number()
click to toggle source
# File lib/ffakerer/phone_number_se.rb, line 33 def mobile_phone_number Faker.numerify("0#{mobile_phone_number_format}") end
mobile_phone_number_format()
click to toggle source
# File lib/ffakerer/phone_number_se.rb, line 73 def mobile_phone_number_format MOBILE_PHONE_FORMAT.rand % mobile_prefix end
mobile_prefix()
click to toggle source
# File lib/ffakerer/phone_number_se.rb, line 69 def mobile_prefix MOBILE_PHONE_PREFIX.rand end
phone_number()
click to toggle source
# File lib/ffakerer/phone_number_se.rb, line 22 def phone_number case rand(2) when 0 then home_work_phone_number when 1 then mobile_phone_number end end
phone_number_format()
click to toggle source
# File lib/ffakerer/phone_number_se.rb, line 60 def phone_number_format prefix = area_prefix case prefix.length when 1 then PHONE_FORMAT_PREFIX_2.rand when 2 then PHONE_FORMAT_PREFIX_3.rand when 3 then PHONE_FORMAT_PREFIX_4.rand end % prefix end