Sha256: b818e0b3a2e8867317ab246a342815d1018079581f9e22b70696ea1f717cc7c7

Contents?: true

Size: 648 Bytes

Versions: 5

Compression:

Stored size: 648 Bytes

Contents

# encoding: utf-8

module Faker
  module PhoneNumberFR
    extend ModuleUtils
    extend self

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

    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.sample}#{AREA_PREFIX.sample}#{PHONE_NUMBER.sample}"
    end

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

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/ffaker-1.32.1/lib/ffaker/phone_number_fr.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/ffaker-1.32.1/lib/ffaker/phone_number_fr.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/ffaker-1.32.1/lib/ffaker/phone_number_fr.rb
ffaker-1.32.1 lib/ffaker/phone_number_fr.rb
ffaker-1.32.0 lib/ffaker/phone_number_fr.rb