Class: JapaneseAddressParser::Town
- Inherits:
-
Data
- Object
- Data
- JapaneseAddressParser::Town
- Defined in:
- lib/japanese_address_parser/town.rb,
lib/japanese_address_parser/town.rb,
sig/address.rbs
Overview
町字のリッチ VO。name は machiAzaName(大字+丁目+小字)。point は代表点(NormalizeResultPoint, level 3)。 chome は "一丁目" 等の文字列、chome_n は 1 等の整数(JS SingleMachiAza が両方持つため両方公開する)。
Instance Attribute Summary collapse
-
#chome ⇒ Object
readonly
Returns the value of attribute chome.
-
#chome_n ⇒ Object
readonly
Returns the value of attribute chome_n.
-
#koaza ⇒ Object
readonly
Returns the value of attribute koaza.
-
#machiaza_id ⇒ Object
readonly
Returns the value of attribute machiaza_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#point ⇒ Object
readonly
Returns the value of attribute point.
Class Method Summary collapse
-
.from_metadata(hash) ⇒ Town?
metadata.machi_aza(csv_ranges を除いた Hash・Symbol キー)から VO を作る。town 未判別なら nil。 point(level 3 代表点)は町字によっては存在しないため from_lng_lat が nil を返す。 name は Hash 入力のため SingleMachiAza#machi_aza_name を呼べない。式は同メソッド(JS: machiAzaName)と一致させる。.
- .new ⇒ instance
Instance Method Summary collapse
-
#to_h ⇒ Hash[Symbol, untyped]
緯度経度をネストも含めて Hash 化する Ruby 独自 API。.
Instance Attribute Details
#chome ⇒ Object (readonly)
Returns the value of attribute chome
12 13 14 |
# File 'lib/japanese_address_parser/town.rb', line 12 def chome @chome end |
#chome_n ⇒ Object (readonly)
Returns the value of attribute chome_n
12 13 14 |
# File 'lib/japanese_address_parser/town.rb', line 12 def chome_n @chome_n end |
#koaza ⇒ Object (readonly)
Returns the value of attribute koaza
12 13 14 |
# File 'lib/japanese_address_parser/town.rb', line 12 def koaza @koaza end |
#machiaza_id ⇒ Object (readonly)
Returns the value of attribute machiaza_id
12 13 14 |
# File 'lib/japanese_address_parser/town.rb', line 12 def machiaza_id @machiaza_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name
12 13 14 |
# File 'lib/japanese_address_parser/town.rb', line 12 def name @name end |
#point ⇒ Object (readonly)
Returns the value of attribute point
12 13 14 |
# File 'lib/japanese_address_parser/town.rb', line 12 def point @point end |
Class Method Details
.from_metadata(hash) ⇒ Town?
metadata.machi_aza(csv_ranges を除いた Hash・Symbol キー)から VO を作る。town 未判別なら nil。 point(level 3 代表点)は町字によっては存在しないため from_lng_lat が nil を返す。 name は Hash 入力のため SingleMachiAza#machi_aza_name を呼べない。式は同メソッド(JS: machiAzaName)と一致させる。
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/japanese_address_parser/town.rb', line 19 def self.(hash) return if hash.nil? new( name: "#{hash[:oaza_cho]}#{hash[:chome]}#{hash[:koaza]}", machiaza_id: hash[:machiaza_id], chome: hash[:chome], chome_n: hash[:chome_n], koaza: hash[:koaza], point: NormalizeResultPoint.from_lng_lat(hash[:point], level: 3) ) end |
.new ⇒ instance
39 |
# File 'sig/address.rbs', line 39
def self.new: (name: String, machiaza_id: String, chome: String?, chome_n: Integer?, koaza: String?, point: NormalizeResultPoint?) -> instance
|
Instance Method Details
#to_h ⇒ Hash[Symbol, untyped]
緯度経度をネストも含めて Hash 化する Ruby 独自 API。
33 34 35 |
# File 'lib/japanese_address_parser/town.rb', line 33 def to_h { name:, machiaza_id:, chome:, chome_n:, koaza:, point: point&.to_h } end |