Sha256: b14059921ac79adba0656f24013e2596120830f98b8cf096f1d593f60e2df9bc

Contents?: true

Size: 756 Bytes

Versions: 2

Compression:

Stored size: 756 Bytes

Contents

# frozen_string_literal: true

module FFaker
  module AddressIT

    extend ModuleUtils
    extend self

    NUM = ['#', '##', '##', '###', '####', '#-##'].freeze
    SEP = [', ', ' '].freeze
    TYPE = %w[via viale piazza piazzale].freeze
    POSTAL_CODE_FORMATS = ['#####'].freeze

    def street_address
      FFaker.numerify(fetch_sample(NUM)) +
        fetch_sample(SEP) +
        fetch_sample(TYPE) + ' ' +
        FFaker::NameIT.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

2 entries across 2 versions & 1 rubygems

Version Path
ffaker-2.20.0 lib/ffaker/address_it.rb
ffaker-2.19.0 lib/ffaker/address_it.rb