Sha256: 58f472de1a190cfecdd2dd6bb2011c3911598de37dea2b4c81d515a04624e153

Contents?: true

Size: 731 Bytes

Versions: 6

Compression:

Stored size: 731 Bytes

Contents

# frozen_string_literal: true

module FFaker
  module AddressNL
    include FFaker::Address

    extend ModuleUtils
    extend self

    def postal_code
      FFaker::String.from_regexp(/[1-9]\d{3} [A-RT-Z][A-Z]/)
    end

    def zip_code
      postal_code
    end

    def street_name
      name = fetch_sample([true, false]) ? NameNL.last_name : NameNL.first_name
      name + random_type_of_street
    end

    def city
      fetch_sample(CITY)
    end

    def province
      fetch_sample(PROVINCE)
    end

    private

    def random_type_of_street
      case rand(0..19)
      when 0 then 'weg'
      when 1 then 'boulevard'
      when 3 then 'pad'
      when 4 then 'steeg'
      else 'straat'
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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