Sha256: 81a68af7c840f684571e77b54d7ac1ec3123d82f2fc9bcdd6a5be91d25befb68

Contents?: true

Size: 703 Bytes

Versions: 1

Compression:

Stored size: 703 Bytes

Contents

# frozen_string_literal: true

module FFakerTW
  module AddressDE
    include FFakerTW::Address

    extend ModuleUtils
    extend self

    def zip_code
      FFakerTW.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

1 entries across 1 versions & 1 rubygems

Version Path
ffakerTW-0.1.0 lib/ffakerTW/address_de.rb