Sha256: 38af1b495f03da942f3decf11ef040b228d9a0b3cb27171507e2cbce9b333ddd
Contents?: true
Size: 501 Bytes
Versions: 2
Compression:
Stored size: 501 Bytes
Contents
require 'yaml' module TaxJp class Prefecture attr_reader :code, :name def initialize(code, name) @code = code @name = name end @@prefectures = {} TaxJp::Utils.load_yaml('prefectures.yml')['prefectures'].each do |key, value| code = "%02d" % key.to_i @@prefectures[code] = Prefecture.new(code, value) end def self.all @@prefectures.values end def self.find_by_code(code) @@prefectures["%02d" % code.to_i] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tax_jp-0.0.6 | lib/tax_jp/prefecture.rb |
tax_jp-0.0.5 | lib/tax_jp/prefecture.rb |