module FFaker::PhoneNumberPL

Inspirations: pl.wikipedia.org/wiki/Numery_telefoniczne_w_Polsce pl.wikipedia.org/wiki/Plan_numeracji_krajowej

Constants

AREA_CODES
COUNTRY_CODE
MOBILE_PREFIXES
PHONE_NUMBER_FORMAT

Public Instance Methods

area_code() click to toggle source
# File lib/ffaker/phone_number_pl.rb, line 50
def area_code
  fetch_sample(AREA_CODES)
end
home_work_phone_number() click to toggle source
# File lib/ffaker/phone_number_pl.rb, line 27
def home_work_phone_number
  FFaker.numerify(phone_number_format)
end
international_home_work_phone_number() click to toggle source
# File lib/ffaker/phone_number_pl.rb, line 46
def international_home_work_phone_number
  FFaker.numerify("#{COUNTRY_CODE} #{phone_number_format}")
end
international_mobile_phone_number() click to toggle source
# File lib/ffaker/phone_number_pl.rb, line 42
def international_mobile_phone_number
  FFaker.numerify("#{COUNTRY_CODE} #{mobile_phone_number_format}")
end
international_phone_number() click to toggle source
# File lib/ffaker/phone_number_pl.rb, line 35
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_pl.rb, line 31
def mobile_phone_number
  FFaker.numerify(mobile_phone_number_format)
end
mobile_phone_number_format() click to toggle source
# File lib/ffaker/phone_number_pl.rb, line 63
def mobile_phone_number_format
  prefix = mobile_prefix
  PHONE_NUMBER_FORMAT % prefix
end
mobile_prefix() click to toggle source
# File lib/ffaker/phone_number_pl.rb, line 54
def mobile_prefix
  fetch_sample(MOBILE_PREFIXES)
end
phone_number() click to toggle source
# File lib/ffaker/phone_number_pl.rb, line 20
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_pl.rb, line 58
def phone_number_format
  prefix = area_code
  PHONE_NUMBER_FORMAT % prefix
end