Class: JapaneseAddressParser::Prefecture
- Inherits:
-
Data
- Object
- Data
- JapaneseAddressParser::Prefecture
- Defined in:
- lib/japanese_address_parser/prefecture.rb,
lib/japanese_address_parser/prefecture.rb,
sig/address.rbs
Overview
都道府県のリッチ VO。point は代表点(NormalizeResultPoint, level 1)。
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#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.
Class Method Summary collapse
-
.from_metadata(hash) ⇒ Prefecture?
metadata.prefecture(cities を除いた Hash・Symbol キー)から VO を作る。pref 未判別なら nil。 point(level 1 代表点)は都道府県データに必ず存在する(from_lng_lat は 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/prefecture.rb', line 11 def code @code end |
#name ⇒ Object (readonly)
Returns the value of attribute name
11 12 13 |
# File 'lib/japanese_address_parser/prefecture.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/prefecture.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/prefecture.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/prefecture.rb', line 11 def point @point end |
Class Method Details
.from_metadata(hash) ⇒ Prefecture?
metadata.prefecture(cities を除いた Hash・Symbol キー)から VO を作る。pref 未判別なら nil。 point(level 1 代表点)は都道府県データに必ず存在する(from_lng_lat は nil 受けも安全)。
17 18 19 20 21 |
# File 'lib/japanese_address_parser/prefecture.rb', line 17 def self.(hash) return if hash.nil? new(name: hash[:pref], code: hash[:code], name_kana: hash[:pref_k], name_romaji: hash[:pref_r], point: NormalizeResultPoint.from_lng_lat(hash[:point], level: 1)) end |
.new ⇒ instance
12 |
# File 'sig/address.rbs', line 12
def self.new: (name: String, code: Integer, name_kana: String, name_romaji: String, point: NormalizeResultPoint) -> instance
|
Instance Method Details
#to_h ⇒ Hash[Symbol, untyped]
緯度経度をネストも含めて Hash 化する Ruby 独自 API。
24 25 26 |
# File 'lib/japanese_address_parser/prefecture.rb', line 24 def to_h { name:, code:, name_kana:, name_romaji:, point: point.to_h } end |