lib/japan_municipality.rb in japan_municipality-1.0.0 vs lib/japan_municipality.rb in japan_municipality-1.0.1
- old
+ new
@@ -2,10 +2,14 @@
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
@@ -20,8 +24,9 @@
@merger_dissolution_date = data[6]
@has_merger_dissolution_infomation = data[7]
end
# https://www.e-stat.go.jp/municipalities/cities/areacode
- DATA = CSV.read("data/municipalities.csv").freeze
- private_constant :DATA
+ CSV_PATH = File.expand_path("../../data/municipalities.csv", __FILE__)
+ DATA = CSV.read(CSV_PATH).freeze
+ private_constant :CSV_PATH, :DATA
end