Module: JpPrefecture::ZipMapping

Defined in:
lib/jp_prefecture/zip_mapping.rb

Overview

コードと郵便番号のマッピング

Class Method Summary collapse

Class Method Details

.code_for_zip(zip) ⇒ Object



16
17
18
19
20
# File 'lib/jp_prefecture/zip_mapping.rb', line 16

def self.code_for_zip(zip)
  data.select do |_code, zip_ranges|
    zip_ranges.find { |range| range.include? zip }
  end.keys.first
end

.dataObject



12
13
14
# File 'lib/jp_prefecture/zip_mapping.rb', line 12

def self.data
  JpPrefecture.config.zip_mapping_data || @data
end