module FFaker::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

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/ffaker/phone_number_se.rb, line 67
def area_prefix
  fetch_sample(PHONE_PREFIX)
end
country_prefix() click to toggle source
# File lib/ffaker/phone_number_se.rb, line 55
def country_prefix
  fetch_sample(COUNTRY_PREFIX)
end
home_work_phone_number() click to toggle source
# File lib/ffaker/phone_number_se.rb, line 40
def home_work_phone_number
  FFaker.numerify("0#{phone_number_format}")
end
international_home_work_phone_number() click to toggle source
# File lib/ffaker/phone_number_se.rb, line 63
def international_home_work_phone_number
  FFaker.numerify("#{country_prefix} (0)#{phone_number_format}")
end
international_mobile_phone_number() click to toggle source
# File lib/ffaker/phone_number_se.rb, line 59
def international_mobile_phone_number
  FFaker.numerify("#{country_prefix} (0)#{mobile_phone_number_format}")
end
international_phone_number() click to toggle source
# File lib/ffaker/phone_number_se.rb, line 48
def international_phone_number
  case rand(0..1)
  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/ffaker/phone_number_se.rb, line 44
def mobile_phone_number
  FFaker.numerify("0#{mobile_phone_number_format}")
end
mobile_phone_number_format() click to toggle source
# File lib/ffaker/phone_number_se.rb, line 84
def mobile_phone_number_format
  fetch_sample(MOBILE_PHONE_FORMAT) % mobile_prefix
end
mobile_prefix() click to toggle source
# File lib/ffaker/phone_number_se.rb, line 80
def mobile_prefix
  fetch_sample(MOBILE_PHONE_PREFIX)
end
phone_number() click to toggle source
# File lib/ffaker/phone_number_se.rb, line 33
def phone_number
  case rand(0..1)
  when 0 then home_work_phone_number
  when 1 then mobile_phone_number
  end
end
phone_number_format() click to toggle source
# File lib/ffaker/phone_number_se.rb, line 71
def phone_number_format
  prefix = area_prefix
  case prefix.length
  when 1 then fetch_sample(PHONE_FORMAT_PREFIX_2)
  when 2 then fetch_sample(PHONE_FORMAT_PREFIX_3)
  when 3 then fetch_sample(PHONE_FORMAT_PREFIX_4)
  end % prefix
end