Module: FFaker::PhoneNumberCH
- Extended by:
- ModuleUtils, PhoneNumberCH
- Included in:
- PhoneNumberCH
- Defined in:
- lib/ffaker/phone_number_ch.rb
Constant Summary collapse
- COUNTRY_PREFIX =
%w[+41 0041 0].freeze
- AREA_PREFIX =
%w[21 22 24 26 27 31 32 33 34 41 43 44 51 52 56 58 61 62 71 81 91].freeze
- MOBILE_PREFIX =
%w[74 75 76 77 78 79].freeze
- FREE_PHONE_PREFIX =
%w[800].freeze
- SHARED_COST_PREFIX =
%w[840 842 844 848].freeze
- PREMIUM_RATE_PREFIX =
%w[900 901 906].freeze
- PHONE_NUMBER =
['#######', ' ### ## ##'].freeze
Instance Method Summary collapse
- #free_phone_number ⇒ Object
- #home_work_phone_number ⇒ Object
- #mobile_phone_number ⇒ Object
- #phone_number ⇒ Object
- #premium_rate_phone_number ⇒ Object
- #shared_cost_phone_number ⇒ Object
Methods included from ModuleUtils
const_missing, k, luhn_check, underscore, unique
Methods included from RandomUtils
#fetch_sample, #rand, #shuffle
Instance Method Details
#free_phone_number ⇒ Object
34 35 36 |
# File 'lib/ffaker/phone_number_ch.rb', line 34 def free_phone_number FFaker.numerify "#{COUNTRY_PREFIX.sample}#{FREE_PHONE_PREFIX.sample}#{PHONE_NUMBER.sample}" end |
#home_work_phone_number ⇒ Object
26 27 28 |
# File 'lib/ffaker/phone_number_ch.rb', line 26 def home_work_phone_number FFaker.numerify "#{COUNTRY_PREFIX.sample}#{AREA_PREFIX.sample}#{PHONE_NUMBER.sample}" end |
#mobile_phone_number ⇒ Object
30 31 32 |
# File 'lib/ffaker/phone_number_ch.rb', line 30 def mobile_phone_number FFaker.numerify "#{COUNTRY_PREFIX.sample}#{MOBILE_PREFIX.sample}#{PHONE_NUMBER.sample}" end |
#phone_number ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/ffaker/phone_number_ch.rb', line 16 def phone_number case rand(0..4) when 0 then home_work_phone_number when 1 then mobile_phone_number when 2 then free_phone_number when 3 then shared_cost_phone_number when 4 then premium_rate_phone_number end end |
#premium_rate_phone_number ⇒ Object
42 43 44 |
# File 'lib/ffaker/phone_number_ch.rb', line 42 def premium_rate_phone_number FFaker.numerify "#{COUNTRY_PREFIX.sample}#{PREMIUM_RATE_PREFIX.sample}#{PHONE_NUMBER.sample}" end |
#shared_cost_phone_number ⇒ Object
38 39 40 |
# File 'lib/ffaker/phone_number_ch.rb', line 38 def shared_cost_phone_number FFaker.numerify "#{COUNTRY_PREFIX.sample}#{SHARED_COST_PREFIX.sample}#{PHONE_NUMBER.sample}" end |