Sha256: ef888e7fb190791c290e7e79b57e725c3ea12288d04a688191c731ec4a5b352d

Contents?: true

Size: 646 Bytes

Versions: 4

Compression:

Stored size: 646 Bytes

Contents

# encoding: utf-8

module Faker
  module PhoneNumberFR
    extend ModuleUtils
    extend self

    def phone_number
      case rand(2)
      when 0 then home_work_phone_number
      when 1 then mobile_phone_number
      end
    end

    def home_work_phone_number
      Faker.numerify "#{COUNTRY_PREFIX.rand}#{AREA_PREFIX.rand}#{PHONE_NUMBER.rand}" 
    end

    def mobile_phone_number
      Faker.numerify "#{COUNTRY_PREFIX.rand}#{MOBILE_PREFIX.rand}#{PHONE_NUMBER.rand}" 
    end

    COUNTRY_PREFIX = k %w[+33 0033 0]
    AREA_PREFIX = k %w[1 2 3 4 5]
    MOBILE_PREFIX = k %w[6 7]
    PHONE_NUMBER = k ['########', ' ## ## ## ##']
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ffaker-1.30.0 lib/ffaker/phone_number_fr.rb
ffaker-1.25.0 lib/ffaker/phone_number_fr.rb
ffaker-1.24.0 lib/ffaker/phone_number_fr.rb
ffaker-1.23.0 lib/ffaker/phone_number_fr.rb