module FFaker::Address
def building_number
def building_number FFaker.numerify(('#' * rand(3..5))) end
def city
def city case rand(0..3) when 0 then format('%s %s%s', city_prefix, Name.first_name, city_suffix) when 1 then format('%s %s', city_prefix, Name.first_name) when 2 then format('%s%s', Name.first_name, city_suffix) when 3 then format('%s%s', Name.last_name, city_suffix) end end
def city_prefix
def city_prefix fetch_sample(CITY_PREFIXES) end
def city_suffix
def city_suffix fetch_sample(CITY_SUFFIXES) end
def country(given_code = nil)
def country(given_code = nil) country_index = COUNTRY_CODE.index(given_code) if given_code && country_index COUNTRY[country_index] else fetch_sample(COUNTRY) end end
def country_code(given_country = nil)
def country_code(given_country = nil) code_index = COUNTRY.index(given_country) if given_country && code_index COUNTRY_CODE[code_index] else fetch_sample(COUNTRY_CODE) end end
def neighborhood
def neighborhood fetch_sample(NEIGHBORHOOD) end
def secondary_address
def secondary_address FFaker.numerify(fetch_sample(SEC_ADDR)) end
def street_address(include_secondary = false)
def street_address(include_secondary = false) str = +"#{building_number} #{street_name}" str << " #{secondary_address}" if include_secondary str end
def street_name
def street_name case rand(0..1) when 0 then "#{Name.last_name} #{street_suffix}" when 1 then "#{Name.first_name} #{street_suffix}" end end
def street_suffix
def street_suffix fetch_sample(STREET_SUFFIX) end
def time_zone
def time_zone fetch_sample(TIME_ZONE) end
def uk_country
def uk_country warn '[uk_country] is deprecated. For UK addresses please use the AddressUK module' FFaker::AddressUK.country end
def uk_county
- UK specific address info. Moved into {AddressUK}
def uk_county warn '[uk_county] is deprecated. For UK addresses please use the AddressUK module' FFaker::AddressUK.county end
def uk_postcode
def uk_postcode warn '[uk_postcode] is deprecated. For UK addresses please use the AddressUK module' FFaker::AddressUK.postcode end
def us_state
def us_state warn '[us_state] is deprecated. For US addresses please use the AddressUS module' FFaker::AddressUS.state end
def us_state_abbr
def us_state_abbr warn '[state_abbr] is deprecated. For US addresses please use the AddressUS module' FFaker::AddressUS.state_abbr end
def zip_code
- US specific address info. Moved into {AddressUS}
def zip_code warn '[zip_code] is deprecated. For US addresses please use the AddressUS module' FFaker::AddressUS.zip_code end