Sha256: b92203b74a1f8398fd0b1419fad6863d1b03ca1189afb4ea7d83c88d25417f09

Contents?: true

Size: 899 Bytes

Versions: 6

Compression:

Stored size: 899 Bytes

Contents

# encoding: utf-8

require 'ffaker/address'

module FFaker
  module AddressFR
    include FFaker::Address

    extend ModuleUtils
    extend self

    NUM = ['#', '##', '##', '###', '####', '#-##'].freeze
    MOD = [' B', ' T', ' Q', ' BIS', ' TER', ' QUATER', '', '', '', ''].freeze
    SEP = [', ', ' '].freeze
    TYPE = %w[rue avenue av boulevard bd impasse].freeze
    POSTAL_CODE_FORMATS = ['####', '#####', '97####', '2A###', '2B###'].freeze

    def street_address
      FFaker.numerify(fetch_sample(NUM)) +
        fetch_sample(MOD) +
        fetch_sample(SEP) +
        fetch_sample(TYPE) + ' ' +
        FFaker::NameFR.name
    end

    def postal_code
      FFaker.numerify(fetch_sample(POSTAL_CODE_FORMATS))
    end

    def city
      fetch_sample(CITY)
    end

    def full_address
      %(#{street_address}#{fetch_sample(SEP)}#{postal_code} #{fetch_sample(CITY)})
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ffaker-2.11.0 lib/ffaker/address_fr.rb
ffaker-2.10.0 lib/ffaker/address_fr.rb
ffaker-2.9.0 lib/ffaker/address_fr.rb
ffaker-2.8.1 lib/ffaker/address_fr.rb
ffaker-2.8.0 lib/ffaker/address_fr.rb
ffaker-2.7.0 lib/ffaker/address_fr.rb