jp_zip_code 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cfda4402f543d7229077caae2ca263e0ad96728f
4
- data.tar.gz: 6245b9c30bc16e8b6d65fd79d76a9839c499eac3
3
+ metadata.gz: e290002e137bf4cd02f53d7d2cda45d86924b9c5
4
+ data.tar.gz: bd03bbebc89e81b7ce2b5a59efe2b7aa8cee414e
5
5
  SHA512:
6
- metadata.gz: f76f1ab97127ab15df8babaa0a7db8be0926477aee976a1acaf399660cb66cadc8f28862b739f214c8e164b11ca376db287a59fe53bec5df6a3fa5ffb1151139
7
- data.tar.gz: 5835ddf36761269df427591f77dac47dc05a890286920c4ae2106da069076ab1a7f2edc4c4f399ba059ee2debfccb8efce2bb3aa2832d0d86727cf4ff7a4767f
6
+ metadata.gz: 784451997f12f43e7074d3dbdadf6402a2add0f5b888b93072ceb6efb113e31b46760c5bff1035b64a4c0665579de012b292865a515864ba68a7ecb18e8687b2
7
+ data.tar.gz: bfbfd1b7a7984a508e3cae9c3176b0a2c58b1a12c889fa6007ac628178e4d77a6a9e696f20da33ec63641e74bafe940f45c79c914eb33a702cc2040db9e75b3f
data/lib/jp_zip_code.rb CHANGED
@@ -19,8 +19,10 @@ module JpZipCode
19
19
  end
20
20
 
21
21
  def self.convert(data)
22
+ data['pref_code'] = pref_codes.invert[data['pref_kanji']].to_s
23
+
22
24
  data.each_with_object({}) do |(key, value), hash|
23
- converted = %w(イカニケイサイガナイバアイ IKANIKEISAIGANAIBAAI 以下に掲載がない場合).include?(value) ? "" : value
25
+ converted = %w(イカニケイサイガナイバアイ IKANIKEISAIGANAIBAAI 以下に掲載がない場合).include?(value) ? '' : value
24
26
  converted = converted.gsub(/\(.*\)/, '').gsub(/(.*)/, '')
25
27
  converted = converted.split(' ').map(&:capitalize).join(' ')
26
28
  %w(Ken To Fu Shi Gun Ku Machi).each do |suffix|
@@ -30,6 +32,10 @@ module JpZipCode
30
32
  end
31
33
  end
32
34
 
35
+ def self.pref_codes
36
+ YAML.load(File.open('data/pref_code.yaml'))
37
+ end
38
+
33
39
  def self.update
34
40
  JpZipCode::Updater.new(false).execute
35
41
  end
@@ -1,3 +1,3 @@
1
1
  module JpZipCode
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jp_zip_code
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kimromi