Module: FFaker::AddressKR

Extended by:
AddressKR, ModuleUtils
Included in:
AddressKR
Defined in:
lib/ffaker/address_kr.rb

Constant Summary collapse

BUILDING_DONGS =
%w[      ## ###].freeze
BUILDING_SUFFIXES =
%w[빌라 아파트 연립 마을 타운 타워].freeze
STREET_SUFFIXES =
%w[ #로  #가 거리 ].freeze
TOWN_SUFFIXES =
%w[  마을].freeze
METROPOLITAN_CITIES =
%w[서울특별시 부산광역시 대구광역시 인천광역시
광주광역시 대전광역시 울산광역시 세종특별자치시].freeze
PROVINCES =
%w[경기도 강원도 충청북도 충청남도 전라북도 전라남도 경상북도
경상남도 제주특별자치도].freeze

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, luhn_check, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#address_detailObject



55
56
57
58
59
60
61
# File 'lib/ffaker/address_kr.rb', line 55

def address_detail
  FFaker.numerify(fetch_sample([
                                 building_name,
                                 "#{building_name} ###호",
                                 "#{building_name} #{fetch_sample(BUILDING_DONGS)} ###호"
                               ]))
end

#boroughObject



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

def borough
  fetch_sample(BOROUGHS)
end

#building_nameObject



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

def building_name
  "#{NameKR.first_name}#{fetch_sample(BUILDING_SUFFIXES)}"
end

#cityObject



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

def city
  fetch_sample(CITIES)
end

#land_addressObject



34
35
36
37
38
39
# File 'lib/ffaker/address_kr.rb', line 34

def land_address
  fetch_sample([
                 "#{metropolitan_city} #{borough} #{town} #{land_number}",
                 "#{province} #{town} #{land_number}"
               ])
end

#land_numberObject



41
42
43
44
45
46
47
48
49
# File 'lib/ffaker/address_kr.rb', line 41

def land_number
  FFaker.numerify(fetch_sample([
                                 '###',
                                 '###-#',
                                 '###-##',
                                 '####',
                                 '####-#'
                               ]))
end

#metropolitan_cityObject



83
84
85
# File 'lib/ffaker/address_kr.rb', line 83

def metropolitan_city
  fetch_sample(METROPOLITAN_CITIES)
end

#old_postal_codeObject



21
22
23
# File 'lib/ffaker/address_kr.rb', line 21

def old_postal_code
  FFaker.numerify('###-###')
end

#postal_codeObject



17
18
19
# File 'lib/ffaker/address_kr.rb', line 17

def postal_code
  FFaker.numerify('#####')
end

#provinceObject



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

def province
  fetch_sample(PROVINCES)
end

#road_addessObject



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

def road_addess
  fetch_sample([
                 "#{metropolitan_city} #{borough} #{street}",
                 "#{province} #{town} #{street}",
                 "#{metropolitan_city} #{borough} #{street} (#{town})",
                 "#{province} #{town} #{street} (#{town})"
               ])
end

#streetObject



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

def street
  FFaker.numerify("#{NameKR.first_name}#{fetch_sample(STREET_SUFFIXES)}")
end

#townObject



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

def town
  "#{NameKR.first_name}#{fetch_sample(TOWN_SUFFIXES)}"
end