jipcode 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/jipcode/version.rb +1 -1
- data/lib/jipcode.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b16697bdbbbd0282bc0ce95cff6fe00ad1612b36a3172b8ef77ae0569f69d89f
|
4
|
+
data.tar.gz: 9222f81bf6edd24dd1933198bc43a92984363a69796a38483e234e365f89c307
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ac0781e1f46580724f7af2769efa4848b29285a3e8002a42eaa83022b00776c410343ba00d6bf878279973fba3af164296339e5b8caf7a61a9fa565b8393502
|
7
|
+
data.tar.gz: 490d41788da4f96362ab4baec4584ec0d6ad99dbbd281580a51a389cebd84e0c5f2935e4e03e431ba13654e11776bb8ba81f5401752740d4e5e1e918d8bf346a
|
data/Gemfile.lock
CHANGED
data/lib/jipcode/version.rb
CHANGED
data/lib/jipcode.rb
CHANGED
@@ -5,6 +5,10 @@ module Jipcode
|
|
5
5
|
ZIPCODE_PATH = "#{File.dirname(__FILE__)}/../zipcode/latest".freeze
|
6
6
|
|
7
7
|
def locate(zipcode)
|
8
|
+
# 数字7桁以外の入力は受け付けない
|
9
|
+
return [] unless zipcode =~ /\A\d{7}?\z/
|
10
|
+
|
11
|
+
# 上3桁にマッチするファイルが存在しなければ該当なし
|
8
12
|
path = "#{ZIPCODE_PATH}/#{zipcode[0..2]}.csv"
|
9
13
|
return [] unless File.exist?(path)
|
10
14
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jipcode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rinkei
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|