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, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#address_detailObject


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

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

#boroughObject


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

def borough
  fetch_sample(BOROUGHS)
end

#building_nameObject


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

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

#cityObject


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

def city
  fetch_sample(CITIES)
end

#land_addressObject


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

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

#land_numberObject


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

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

#metropolitan_cityObject


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

def metropolitan_city
  fetch_sample(METROPOLITAN_CITIES)
end

#old_postal_codeObject


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

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

#postal_codeObject


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

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

#provinceObject


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

def province
  fetch_sample(PROVINCES)
end

#road_addessObject


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

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

#streetObject


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

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

#townObject


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

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