Module: Faker::AddressAU
- Extended by:
- AddressAU, ModuleUtils
- Includes:
- Address
- Included in:
- AddressAU
- Defined in:
- lib/ffaker/address_au.rb
Constant Summary
- ZIP_FORMATS =
k ['####']
- STATE =
based on areas labeled state (+act) here: en.wikipedia.org/wiki/States_and_territories_of_Australia
k ['Australian Capital Territory', 'New South Wales', 'Queensland', 'South Australia', 'Tasmania', 'Victoria', 'Western Australia']
- STATE_ABBR =
k %w(ACT NSW NT QLD SA TAS VIC WA)
- CITY =
{ "ACT" => ["Canberra", "Ainslie", "Braddon", "O'Connor"], "NSW" => ["Albury", "Armidale", "Bankstown", "Bathurst", "Blacktown", "Blue Mountains", "Botany Bay", "Broken Hill", "Campbelltown", "Canada Bay", "Canterbury", "Cessnock", "Coffs Harbour", "Dubbo", "Fairfield", "Gosford", "Goulburn", "Grafton", "Greater Taree", "Griffith", "Hawkesbury", "Holroyd", "Hurstville", "Lake Macquarie", "Lismore", "Lithgow", "Liverpool", "Maitland", "Newcastle", "Orange", "Parramatta", "Penrith", "Queanbeyan", "Randwick", "Rockdale", "Ryde", "Shellharbour", "Shoalhaven", "Sydney", "Tamworth", "Wagga Wagga", "Willoughby", "Wollongong"], "NT" => ["Darwin","Palmerston"], "QLD" => ["Brisbane", "Bundaberg", "Cairns", "Caloundra", "Charters Towers", "Gladstone", "Gold Coast", "Gympie", "Hervey Bay", "Ipswich", "Logan City", "Mackay", "Maryborough", "Mount Isa", "Redcliffe City", "Redland City", "Rockhampton", "Sunshine Coast", "Surfers Paradise", "Thuringowa", "Toowoomba", "Townsville", "Warwick"], "SA" => ["Adelaide", "Mount Barker", "Mount Gambier", "Murray Bridge", "Port Adelaide", "Port Augusta", "Port Lincoln", "Port Pirie", "Victor Harbor", "Whyalla"], "TAS" => ["Burnie", "Clarence", "Devonport", "Glenorchy", "Hobart", "Launceston"], "VIC" => ["Ararat", "Bairnsdale", "Ballarat", "Benalla", "Bendigo", "Dandenong", "Frankston", "Geelong", "Hamilton", "Horsham", "Melbourne", "Melton", "Mildura", "Moe", "Morwell", "Sale", "Shepparton", "Swan Hill", "Traralgon", "Wangaratta", "Warrnambool", "Wodonga"], "WA" => ["Albany", "Armadale", "Bayswater", "Bunbury", "Canning", "Cockburn", "Fremantle", "Geraldton", "Gosnells", "Joondalup", "Kalgoorlie", "Mandurah", "Melville", "Nedlands", "Perth", "Rockingham", "South Perth", "Stirling", "Subiaco", "Swan", "Wanneroo"] }
- CITIES =
CITY.keys.collect {|k| CITY[k]}.flatten.sort
- ZIP_CODE =
{ "NSW" => [("1000".."1999").to_a + ("2000".."2599").to_a + ("2619".."2898").to_a + ("2921".."2999").to_a].flatten, "ACT" => [("0200".."0299").to_a + ("2600".."2618").to_a + ("2900".."2920").to_a].flatten, "VIC" => [("3000".."3999").to_a + ("8000".."8999").to_a].flatten, "QLD" => [("4000".."4999").to_a + ("9000".."9999").to_a].flatten, "SA" => [("5000".."5799").to_a + ("5800".."5999").to_a].flatten, "WA" => [("6000".."6797").to_a + ("6800".."6999").to_a].flatten, "TAS" => [("7000".."7799").to_a + ("7800".."7999").to_a].flatten, "NT" => [("0800".."0899").to_a + ("0900".."0999").to_a].flatten }
- ZIP_CODES =
ZIP_CODE.keys.collect {|k| ZIP_CODE[k]}.flatten.sort
Constants included from Address
Faker::Address::CITY_PREFIXES, Faker::Address::CITY_SUFFIXES, Faker::Address::COMPASS_DIRECTIONS, Faker::Address::NEIGHBORHOOD, Faker::Address::SEC_ADDR, Faker::Address::STREET_SUFFIX
Instance Method Summary (collapse)
- - (Object) city(st_abbr = nil)
- - (Object) full_address(st_abbr = nil)
- - (Object) state
- - (Object) state_abbr
- - (Object) zip_code(st_abbr = nil) (also: #postcode)
Methods included from ModuleUtils
Methods included from Address
#city_prefix, #city_suffix, #neighborhood, #secondary_address, #street_address, #street_name, #street_suffix, #uk_country, #uk_county, #uk_postcode, #us_state, #us_state_abbr
Instance Method Details
- (Object) city(st_abbr = nil)
24 25 26 27 |
# File 'lib/ffaker/address_au.rb', line 24 def city(st_abbr = nil) st_abbr ||= state_abbr CITY[st_abbr][rand(CITY[st_abbr].size)] end |
- (Object) full_address(st_abbr = nil)
29 30 31 32 |
# File 'lib/ffaker/address_au.rb', line 29 def full_address(st_abbr = nil) st_abbr ||= state_abbr "#{Faker::Address.street_address}, #{city(st_abbr)} #{st_abbr} #{zip_code}" end |
- (Object) state
16 17 18 |
# File 'lib/ffaker/address_au.rb', line 16 def state STATE.rand end |
- (Object) state_abbr
20 21 22 |
# File 'lib/ffaker/address_au.rb', line 20 def state_abbr STATE_ABBR.rand end |
- (Object) zip_code(st_abbr = nil) Also known as: postcode
9 10 11 12 |
# File 'lib/ffaker/address_au.rb', line 9 def zip_code(st_abbr = nil) st_abbr ||= state_abbr ZIP_CODE[st_abbr][rand(ZIP_CODE[st_abbr].size)] end |