Class: JapaneseAddressParser::City
- Inherits:
-
Data
- Object
- Data
- JapaneseAddressParser::City
- Defined in:
- lib/japanese_address_parser/city.rb,
lib/japanese_address_parser/city.rb,
sig/address.rbs
Overview
市区町村のリッチ VO。name は cityName(郡+市+政令区)。point は代表点(NormalizeResultPoint, level 2)。
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#county ⇒ Object
readonly
Returns the value of attribute county.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#name_kana ⇒ Object
readonly
Returns the value of attribute name_kana.
-
#name_romaji ⇒ Object
readonly
Returns the value of attribute name_romaji.
-
#point ⇒ Object
readonly
Returns the value of attribute point.
-
#ward ⇒ Object
readonly
Returns the value of attribute ward.
Class Method Summary collapse
-
.from_metadata(city) ⇒ City?
metadata.city(SingleCity VO)から VO を作る。city 未判別なら nil。.
- .new ⇒ instance
Instance Method Summary collapse
-
#to_h ⇒ Hash[Symbol, untyped]
緯度経度をネストも含めて Hash 化する Ruby 独自 API。.
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code
11 12 13 |
# File 'lib/japanese_address_parser/city.rb', line 11 def code @code end |
#county ⇒ Object (readonly)
Returns the value of attribute county
11 12 13 |
# File 'lib/japanese_address_parser/city.rb', line 11 def county @county end |
#name ⇒ Object (readonly)
Returns the value of attribute name
11 12 13 |
# File 'lib/japanese_address_parser/city.rb', line 11 def name @name end |
#name_kana ⇒ Object (readonly)
Returns the value of attribute name_kana
11 12 13 |
# File 'lib/japanese_address_parser/city.rb', line 11 def name_kana @name_kana end |
#name_romaji ⇒ Object (readonly)
Returns the value of attribute name_romaji
11 12 13 |
# File 'lib/japanese_address_parser/city.rb', line 11 def name_romaji @name_romaji end |
#point ⇒ Object (readonly)
Returns the value of attribute point
11 12 13 |
# File 'lib/japanese_address_parser/city.rb', line 11 def point @point end |
#ward ⇒ Object (readonly)
Returns the value of attribute ward
11 12 13 |
# File 'lib/japanese_address_parser/city.rb', line 11 def ward @ward end |
Class Method Details
.from_metadata(city) ⇒ City?
metadata.city(SingleCity VO)から VO を作る。city 未判別なら nil。
16 17 18 19 20 |
# File 'lib/japanese_address_parser/city.rb', line 16 def self.(city) return if city.nil? new(name: city.city_name, code: city.code, county: city.county, ward: city.ward, name_kana: city.city_k, name_romaji: city.city_r, point: ResultPoint.city_to_result_point(city)) end |
.new ⇒ instance
26 |
# File 'sig/address.rbs', line 26
def self.new: (name: String, code: Integer, county: String?, ward: String?, name_kana: String, name_romaji: String, point: NormalizeResultPoint) -> instance
|
Instance Method Details
#to_h ⇒ Hash[Symbol, untyped]
緯度経度をネストも含めて Hash 化する Ruby 独自 API。
23 24 25 |
# File 'lib/japanese_address_parser/city.rb', line 23 def to_h { name:, code:, county:, ward:, name_kana:, name_romaji:, point: point.to_h } end |