Sha256: faa31c7861fdaf39aaff0a4b5e62998f26736ca7b622b5801fda9f2e0f18cb4d

Contents?: true

Size: 927 Bytes

Versions: 5

Compression:

Stored size: 927 Bytes

Contents

# frozen_string_literal: true

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

    def region
      fetch_sample(REGION)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ffaker-2.22.0 lib/ffaker/address_fr.rb
ffaker-2.21.0 lib/ffaker/address_fr.rb
ffaker-2.20.0 lib/ffaker/address_fr.rb
ffaker-2.19.0 lib/ffaker/address_fr.rb
ffaker-2.18.0 lib/ffaker/address_fr.rb