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


13
14
15
16
17
18
19
20
# File 'lib/ffaker/address_ja.rb', line 13

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


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

def city
  fetch_sample(CITY)
end

#countyObject


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

def county
  fetch_sample(COUNTY)
end

#designated_cityObject


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

def designated_city
  fetch_sample(CITY)
end

#designated_city_addressObject


29
30
31
32
33
34
# File 'lib/ffaker/address_ja.rb', line 29

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

#land_numberObject


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

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

#other_addressObject


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

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

#postal_codeObject


43
44
45
# File 'lib/ffaker/address_ja.rb', line 43

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

#prefectureObject


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

def prefecture
  fetch_sample(PREFECTURE)
end

#streetObject


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

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

#tokyo_wardObject


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

def tokyo_ward
  fetch_sample(TOKYO_WARD)
end

#tokyo_ward_addressObject


36
37
38
39
40
41
# File 'lib/ffaker/address_ja.rb', line 36

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

#villageObject


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

def village
  fetch_sample(VILLAGE)
end

#wardObject


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

def ward
  fetch_sample(WARD)
end