Sha256: 79b1fe4c5bc09e5db98b9b150faca2e97bce248719b0a728c96bd03ab15b25ec

Contents?: true

Size: 697 Bytes

Versions: 6

Compression:

Stored size: 697 Bytes

Contents

# frozen_string_literal: true

module FFaker
  module AddressDE
    include FFaker::Address

    extend ModuleUtils
    extend self

    def zip_code
      FFaker.numerify '#####'
    end

    def state
      fetch_sample(STATE)
    end

    def city
      fetch_sample(CITY)
    end

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

    def street_address
      "#{street_name} #{rand(1..192)}"
    end

    private

    def random_type_of_street
      case rand(0..19)
      when 0 then 'weg'
      when 1 then 'gasse'
      when 3 then 'hain'
      else 'str.'
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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