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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9061e40ffd2f724d3807e569bbea5c2e21c78904c7ad02cce9f66950f1e17d2a
4
- data.tar.gz: 86318a4c74ee141ce9384b8d8ed158c8ace0f2d1b2aa32a862645c1e62da225d
3
+ metadata.gz: b16697bdbbbd0282bc0ce95cff6fe00ad1612b36a3172b8ef77ae0569f69d89f
4
+ data.tar.gz: 9222f81bf6edd24dd1933198bc43a92984363a69796a38483e234e365f89c307
5
5
  SHA512:
6
- metadata.gz: f697df606d3eea50ecde98620735cec9286a7c37071b1303d8a6b2336a516716cb750b3dd52138abbb3836ee702d72cf8942957875c09f3d897ecdaa50b63b29
7
- data.tar.gz: 4932e3b5391ea7ec1b8f504c86d057651260c7d719d4c5ef7daac7da74ccf6be6575793e6df59c7e5542c8f04b402563c9ca6dde7bedc35068007cae2e4b1ac9
6
+ metadata.gz: 8ac0781e1f46580724f7af2769efa4848b29285a3e8002a42eaa83022b00776c410343ba00d6bf878279973fba3af164296339e5b8caf7a61a9fa565b8393502
7
+ data.tar.gz: 490d41788da4f96362ab4baec4584ec0d6ad99dbbd281580a51a389cebd84e0c5f2935e4e03e431ba13654e11776bb8ba81f5401752740d4e5e1e918d8bf346a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jipcode (1.2.0)
4
+ jipcode (1.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module Jipcode
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
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.0
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-08 00:00:00.000000000 Z
11
+ date: 2018-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler