Sha256: f6fdc87a9b24982d98f81e39e6d5b4ffc6f61dcefe4a5704fb66f92044bd7cb7
Contents?: true
Size: 899 Bytes
Versions: 1
Compression:
Stored size: 899 Bytes
Contents
# frozen_string_literal: true require "japan_municipality/version" require "csv" class JapanMunicipality attr_reader :area_code, :prefecture, :subprefecture attr_reader :subprefecture_furigana, :municipality, :municipality_furigana attr_reader :merger_dissolution_date, :has_merger_dissolution_infomation def self.all DATA[2..-1].map do |data| new(data) end end def initialize(data) @area_code = data[0] @prefecture = data[1] @subprefecture = data[2] @subprefecture_furigana = data[3] @municipality = data[4] @municipality_furigana = data[5] @merger_dissolution_date = data[6] @has_merger_dissolution_infomation = data[7] end # https://www.e-stat.go.jp/municipalities/cities/areacode CSV_PATH = File.expand_path("../../data/municipalities.csv", __FILE__) DATA = CSV.read(CSV_PATH).freeze private_constant :CSV_PATH, :DATA end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
japan_municipality-1.0.1 | lib/japan_municipality.rb |