Class: JapaneseAddressParser::Data::SingleMachiAza
- Inherits:
-
Data
- Object
- Data
- JapaneseAddressParser::Data::SingleMachiAza
- Defined in:
- lib/japanese_address_parser/data/single_machi_aza.rb,
lib/japanese_address_parser/data/single_machi_aza.rb,
sig/data.rbs
Overview
SingleMachiAza — api/ja/都道府県名/市区町村名.json の data 要素(町字)。
rsdt は値が存在するとき必ず true(住居表示住所データの存在フラグ)。
csv_ranges は level 8 で住居表示/地番 CSV の該当バイト範囲を引くために保持する。
Instance Attribute Summary collapse
-
#chome ⇒ Object
readonly
Returns the value of attribute chome.
-
#chome_n ⇒ Object
readonly
Returns the value of attribute chome_n.
-
#csv_ranges ⇒ Object
readonly
Returns the value of attribute csv_ranges.
-
#koaza ⇒ Object
readonly
Returns the value of attribute koaza.
-
#koaza_k ⇒ Object
readonly
Returns the value of attribute koaza_k.
-
#koaza_r ⇒ Object
readonly
Returns the value of attribute koaza_r.
-
#machiaza_id ⇒ Object
readonly
Returns the value of attribute machiaza_id.
-
#oaza_cho ⇒ Object
readonly
Returns the value of attribute oaza_cho.
-
#oaza_cho_k ⇒ Object
readonly
Returns the value of attribute oaza_cho_k.
-
#oaza_cho_r ⇒ Object
readonly
Returns the value of attribute oaza_cho_r.
-
#point ⇒ Object
readonly
Returns the value of attribute point.
-
#rsdt ⇒ Object
readonly
Returns the value of attribute rsdt.
Class Method Summary collapse
-
.from_json(hash) ⇒ SingleMachiAza
JSON(パース済み Hash・文字列キー)から VO を生成する Ruby 独自ヘルパ。 csv_ranges は
{ "住居表示" => { "start" => Integer, "length" => Integer }, "地番" => {...} }の構造をそのまま保持する(level 8 のデータアクセスで消費する)。. - .new ⇒ instance
Instance Method Summary collapse
-
#machi_aza_name ⇒ String
JS: machiAzaName(machiAza) =>
${oaza_cho || ''}${chome || ''}${koaza || ''}nil の補間は Ruby では空文字になるため|| ''相当。.
Instance Attribute Details
#chome ⇒ Object (readonly)
Returns the value of attribute chome
11 12 13 |
# File 'lib/japanese_address_parser/data/single_machi_aza.rb', line 11 def chome @chome end |
#chome_n ⇒ Object (readonly)
Returns the value of attribute chome_n
11 12 13 |
# File 'lib/japanese_address_parser/data/single_machi_aza.rb', line 11 def chome_n @chome_n end |
#csv_ranges ⇒ Object (readonly)
Returns the value of attribute csv_ranges
11 12 13 |
# File 'lib/japanese_address_parser/data/single_machi_aza.rb', line 11 def csv_ranges @csv_ranges end |
#koaza ⇒ Object (readonly)
Returns the value of attribute koaza
11 12 13 |
# File 'lib/japanese_address_parser/data/single_machi_aza.rb', line 11 def koaza @koaza end |
#koaza_k ⇒ Object (readonly)
Returns the value of attribute koaza_k
11 12 13 |
# File 'lib/japanese_address_parser/data/single_machi_aza.rb', line 11 def koaza_k @koaza_k end |
#koaza_r ⇒ Object (readonly)
Returns the value of attribute koaza_r
11 12 13 |
# File 'lib/japanese_address_parser/data/single_machi_aza.rb', line 11 def koaza_r @koaza_r end |
#machiaza_id ⇒ Object (readonly)
Returns the value of attribute machiaza_id
11 12 13 |
# File 'lib/japanese_address_parser/data/single_machi_aza.rb', line 11 def machiaza_id @machiaza_id end |
#oaza_cho ⇒ Object (readonly)
Returns the value of attribute oaza_cho
11 12 13 |
# File 'lib/japanese_address_parser/data/single_machi_aza.rb', line 11 def oaza_cho @oaza_cho end |
#oaza_cho_k ⇒ Object (readonly)
Returns the value of attribute oaza_cho_k
11 12 13 |
# File 'lib/japanese_address_parser/data/single_machi_aza.rb', line 11 def oaza_cho_k @oaza_cho_k end |
#oaza_cho_r ⇒ Object (readonly)
Returns the value of attribute oaza_cho_r
11 12 13 |
# File 'lib/japanese_address_parser/data/single_machi_aza.rb', line 11 def oaza_cho_r @oaza_cho_r end |
#point ⇒ Object (readonly)
Returns the value of attribute point
11 12 13 |
# File 'lib/japanese_address_parser/data/single_machi_aza.rb', line 11 def point @point end |
#rsdt ⇒ Object (readonly)
Returns the value of attribute rsdt
11 12 13 |
# File 'lib/japanese_address_parser/data/single_machi_aza.rb', line 11 def rsdt @rsdt end |
Class Method Details
.from_json(hash) ⇒ SingleMachiAza
JSON(パース済み Hash・文字列キー)から VO を生成する Ruby 独自ヘルパ。
csv_ranges は { "住居表示" => { "start" => Integer, "length" => Integer }, "地番" => {...} }
の構造をそのまま保持する(level 8 のデータアクセスで消費する)。
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/japanese_address_parser/data/single_machi_aza.rb', line 18 def self.from_json(hash) new( machiaza_id: hash['machiaza_id'], oaza_cho: hash['oaza_cho'], oaza_cho_k: hash['oaza_cho_k'], oaza_cho_r: hash['oaza_cho_r'], chome: hash['chome'], chome_n: hash['chome_n'], koaza: hash['koaza'], koaza_k: hash['koaza_k'], koaza_r: hash['koaza_r'], rsdt: hash['rsdt'], point: hash['point'], csv_ranges: hash['csv_ranges'] ) end |
.new ⇒ instance
53 |
# File 'sig/data.rbs', line 53
def self.new: (machiaza_id: String, oaza_cho: String?, oaza_cho_k: String?, oaza_cho_r: String?, chome: String?, chome_n: Integer?, koaza: String?, koaza_k: String?, koaza_r: String?, rsdt: true?, point: [Float, Float]?, csv_ranges: Hash[String, Hash[String, Integer]]?) -> instance
|
Instance Method Details
#machi_aza_name ⇒ String
JS: machiAzaName(machiAza) => ${oaza_cho || ''}${chome || ''}${koaza || ''}
nil の補間は Ruby では空文字になるため || '' 相当。
37 38 39 |
# File 'lib/japanese_address_parser/data/single_machi_aza.rb', line 37 def machi_aza_name "#{oaza_cho}#{chome}#{koaza}" end |