Module: FFaker::AddressJA

Extended by:
AddressJA, ModuleUtils
Includes:
Address
Included in:
AddressJA
Defined in:
lib/ffaker/address_ja.rb

Constant Summary collapse

ZIP_FORMATS =
['###-####'].freeze
LAND_NUMBER_FORMATS =
['#丁目#番#号', '###'].freeze

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_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, #zip_code

Instance Method Details

#addressObject


16
17
18
19
20
21
22
23
# File 'lib/ffaker/address_ja.rb', line 16

def address
  fetch_sample([
                 "#{postal_code} #{prefecture}#{city}#{street}#{land_number}",
                 "#{postal_code} #{prefecture}#{county}#{street}#{land_number}",
                 "#{postal_code} #{prefecture}#{designated_city}#{ward}#{street}#{land_number}",
                 "#{postal_code} 東京都#{tokyo_ward}#{street}#{land_number}"
               ])
end

#cityObject


74
75
76
# File 'lib/ffaker/address_ja.rb', line 74

def city
  fetch_sample(CITY)
end

#countyObject


78
79
80
# File 'lib/ffaker/address_ja.rb', line 78

def county
  fetch_sample(COUNTY)
end

#designated_cityObject


70
71
72
# File 'lib/ffaker/address_ja.rb', line 70

def designated_city
  fetch_sample(CITY)
end

#designated_city_addressObject


32
33
34
35
36
37
# File 'lib/ffaker/address_ja.rb', line 32

def designated_city_address
  fetch_sample([
                 # 愛知県名古屋市中区錦3丁目24番4号
                 "#{postal_code} #{prefecture}#{designated_city}#{ward}#{street}#{land_number}"
               ])
end

#land_numberObject


50
51
52
# File 'lib/ffaker/address_ja.rb', line 50

def land_number
  FFaker.numerify(fetch_sample(LAND_NUMBER_FORMATS))
end

#other_addressObject


25
26
27
28
29
30
# File 'lib/ffaker/address_ja.rb', line 25

def other_address
  fetch_sample([
                 "#{postal_code} #{prefecture}#{city}#{street}#{land_number}",
                 "#{postal_code} #{prefecture}#{county}#{street}#{land_number}"
               ])
end

#postal_codeObject


46
47
48
# File 'lib/ffaker/address_ja.rb', line 46

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

#prefectureObject


82
83
84
# File 'lib/ffaker/address_ja.rb', line 82

def prefecture
  fetch_sample(PREFECTURE)
end

#streetObject


54
55
56
# File 'lib/ffaker/address_ja.rb', line 54

def street
  FFaker.numerify(fetch_sample(CITY))
end

#tokyo_wardObject


58
59
60
# File 'lib/ffaker/address_ja.rb', line 58

def tokyo_ward
  fetch_sample(TOKYO_WARD)
end

#tokyo_ward_addressObject


39
40
41
42
43
44
# File 'lib/ffaker/address_ja.rb', line 39

def tokyo_ward_address
  fetch_sample([
                 # 東京都千代田区永田町2丁目2番1号
                 "#{postal_code} 東京都#{tokyo_ward}#{street}#{land_number}"
               ])
end

#villageObject


66
67
68
# File 'lib/ffaker/address_ja.rb', line 66

def village
  fetch_sample(VILLAGE)
end

#wardObject


62
63
64
# File 'lib/ffaker/address_ja.rb', line 62

def ward
  fetch_sample(WARD)
end