Module: FFaker::PhoneNumberAU
- Extended by:
- ModuleUtils, PhoneNumberAU
- Included in:
- PhoneNumberAU
- Defined in:
- lib/ffaker/phone_number_au.rb
Overview
Based on information from en.wikipedia.org/wiki/Telephone_numbers_in_Australia
Constant Summary collapse
- MOBILE_OPERATORS_PREFIX =
Mobile prefixes
%w[04 05].freeze
- HOME_WORK_OPERATORS_PREFIX =
Home or Work Operator prefixes
%w[02 03 07 08].freeze
- OPERATORS_PREFIX =
MOBILE_OPERATORS_PREFIX + HOME_WORK_OPERATORS_PREFIX
Instance Method Summary collapse
- #country_code ⇒ Object
-
#home_work_phone_number ⇒ Object
Generates a general phone number (0x) xxxx xxxx.
-
#home_work_phone_prefix ⇒ Object
Return a prefix in HOME_WORK_OPERATORS_PREFIX.
- #international_home_work_phone_number ⇒ Object
- #international_mobile_phone_number ⇒ Object
- #international_phone_number ⇒ Object
-
#mobile_phone_number ⇒ Object
Generates a mobile phone number 04xx xxx xxx.
-
#mobile_phone_prefix ⇒ Object
Return a prefix in MOBILE_OPERATORS_PREFIX.
-
#phone_number ⇒ Object
generates mobile or home/work number.
- #phone_prefix ⇒ Object
Methods included from ModuleUtils
const_missing, k, luhn_check, underscore, unique
Methods included from RandomUtils
#fetch_sample, #rand, #shuffle
Instance Method Details
#country_code ⇒ Object
57 58 59 |
# File 'lib/ffaker/phone_number_au.rb', line 57 def country_code '+61' end |
#home_work_phone_number ⇒ Object
Generates a general phone number
(0x) xxxx xxxx
38 39 40 |
# File 'lib/ffaker/phone_number_au.rb', line 38 def home_work_phone_number FFaker.numerify("(#{home_work_phone_prefix}) #### ####") end |
#home_work_phone_prefix ⇒ Object
Return a prefix in HOME_WORK_OPERATORS_PREFIX
27 28 29 |
# File 'lib/ffaker/phone_number_au.rb', line 27 def home_work_phone_prefix fetch_sample(HOME_WORK_OPERATORS_PREFIX) end |
#international_home_work_phone_number ⇒ Object
65 66 67 |
# File 'lib/ffaker/phone_number_au.rb', line 65 def international_home_work_phone_number FFaker.numerify("#{country_code} #{home_work_phone_prefix[1]} #### ####") end |
#international_mobile_phone_number ⇒ Object
61 62 63 |
# File 'lib/ffaker/phone_number_au.rb', line 61 def international_mobile_phone_number FFaker.numerify("#{country_code} #{mobile_phone_prefix[1]} #### ####") end |
#international_phone_number ⇒ Object
69 70 71 72 73 74 |
# File 'lib/ffaker/phone_number_au.rb', line 69 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 ⇒ Object
Generates a mobile phone number 04xx xxx xxx
45 46 47 |
# File 'lib/ffaker/phone_number_au.rb', line 45 def mobile_phone_number FFaker.numerify("#{mobile_phone_prefix}## ### ###") end |
#mobile_phone_prefix ⇒ Object
Return a prefix in MOBILE_OPERATORS_PREFIX
20 21 22 |
# File 'lib/ffaker/phone_number_au.rb', line 20 def mobile_phone_prefix fetch_sample(MOBILE_OPERATORS_PREFIX) end |
#phone_number ⇒ Object
generates mobile or home/work number
50 51 52 53 54 55 |
# File 'lib/ffaker/phone_number_au.rb', line 50 def phone_number case rand(0..1) when 0 then home_work_phone_number when 1 then mobile_phone_number end end |
#phone_prefix ⇒ Object
31 32 33 |
# File 'lib/ffaker/phone_number_au.rb', line 31 def phone_prefix fetch_sample(OPERATORS_PREFIX) end |