Module: FFaker::AddressUS

Extended by:
AddressUS, ModuleUtils
Includes:
Address
Included in:
AddressUS
Defined in:
lib/ffaker/address_us.rb

Constant Summary collapse

ZIP_FORMATS =
['#####', '#####-####'].freeze
CONTINENTAL_STATE =
(STATE - %w[Hawaii Alaska])
CONTINENTAL_STATE_ABBR =
(STATE_ABBR - %w[HI AK])

Constants included from Address

FFaker::Address::CITY_PREFIXES, FFaker::Address::COMPASS_DIRECTIONS, FFaker::Address::SEC_ADDR

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Methods included from Address

#building_number, #city, #city_prefix, #city_suffix, #country, #country_code, #neighborhood, #secondary_address, #street_address, #street_name, #street_suffix, #time_zone, #uk_country, #uk_county, #uk_postcode, #us_state, #us_state_abbr

Instance Method Details

#continental_stateObject


34
35
36
# File 'lib/ffaker/address_us.rb', line 34

def continental_state
  fetch_sample(CONTINENTAL_STATE)
end

#continental_state_abbrObject


38
39
40
# File 'lib/ffaker/address_us.rb', line 38

def continental_state_abbr
  fetch_sample(CONTINENTAL_STATE_ABBR)
end

#stateObject


18
19
20
# File 'lib/ffaker/address_us.rb', line 18

def state
  fetch_sample(STATE)
end

#state_abbr(st_name = nil) ⇒ Object


22
23
24
25
26
27
28
# File 'lib/ffaker/address_us.rb', line 22

def state_abbr(st_name = nil)
  return find_abbr(state) unless st_name

  st_name = capitalize_all_words(st_name)
  check_state_existence(st_name)
  find_abbr(st_name)
end

#state_and_territories_abbrObject


30
31
32
# File 'lib/ffaker/address_us.rb', line 30

def state_and_territories_abbr
  fetch_sample(STATE_AND_TERRITORIES_ABBR)
end

#zip_codeObject


14
15
16
# File 'lib/ffaker/address_us.rb', line 14

def zip_code
  FFaker.numerify(fetch_sample(ZIP_FORMATS))
end