taiwan_validator 1.3.3 → 1.3.4

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: 6fccab1315f0f3ee34b19affbf5635bd302d68ea582d86eaa8f4d05253760dc6
4
- data.tar.gz: 62a2adb41e4dd9405cd91639ebf5188c019f9d0bdfce73a455591d6b97a72098
3
+ metadata.gz: 92c06b9deeb7cbc47b3eb9e0f889cbe04f8f1630b77fc6a09e260c3ea7cf0359
4
+ data.tar.gz: 61d31d2565eabfc88ab8a8018da79d035b0e44ccff580c82785f016ea7b08d09
5
5
  SHA512:
6
- metadata.gz: 050b5ee10e93a252f0b3e0aab592855c17ab3f246049973568284b8d0cdf9d5d629d471141f735cf206ee7ccecd5fa6b46494ba4b599d84fdae366699157c7f2
7
- data.tar.gz: 2ffcafc1a8a8d0dd7ad01394a50b56f5162853d9bb37564b2a04952edbc2292740ff19845639b92a479aa5ef55b6e39c47d4d89c585084318079c1da8db32c2d
6
+ metadata.gz: 1f31250474737520801e5897cdfdc556ca8b69b79452e50aceb6c7856ca8cb911bdcf8030e8920a6f336e1bb192d6c2fbc4989cce61496141aa7bc9de981be5a
7
+ data.tar.gz: b24515b87cdbcab1830140449dcf31a7df23e5c83290990d12d58c63f6a74af0afcd1803fd811ebb0cc665dd81bc5272fde250726c553a2fbef9b7abc6baeda1
data/.travis.yml CHANGED
@@ -3,10 +3,9 @@ env:
3
3
  - CC_TEST_REPORTER_ID=85915b296b49680c2c4fd50d2be8f76cc094409297c63b37cf15c145968f1e91
4
4
  language: ruby
5
5
  rvm:
6
- - 2.2.10
7
- - 2.3.7
8
- - 2.4.4
9
- - 2.5.1
6
+ - 2.5.5
7
+ - 2.6.3
8
+ - 2.7.0
10
9
  before_script:
11
10
  - gem install bundler
12
11
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
@@ -4,17 +4,16 @@ class TaiwanValidator::UbnValidator < ActiveModel::EachValidator
4
4
  class << self
5
5
  def valid?(ubn)
6
6
  ubn = ubn.to_s
7
- return false if ubn.size != 8 || (ubn =~ /\A\d+\Z/).nil?
7
+ return false unless ubn.match?(/\A\d{8}\z/)
8
8
 
9
9
  digits = ubn.chars.map(&:to_i)
10
10
  results = digits.zip(MULTIPLIER).map do |op1, op2|
11
11
  digit = op1 * op2
12
12
  digit = digit.to_s.chars.map(&:to_i).reduce(&:+) if number_digits(digit) == 2
13
- digit = digit.to_s.chars.last.to_i if number_digits(digit) == 2
14
13
  digit
15
14
  end.inject(&:+)
16
15
 
17
- results % 10 == 0
16
+ results % 10 == 0 || (ubn[6] == "7" && (results + 1) % 10 == 0)
18
17
  end
19
18
 
20
19
  private
@@ -1,3 +1,3 @@
1
1
  module TaiwanValidator
2
- VERSION = "1.3.3"
2
+ VERSION = "1.3.4"
3
3
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.add_dependency "activemodel", ">= 4.2"
21
21
  spec.add_dependency "activesupport", ">= 4.2"
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.10"
24
- spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "bundler", "> 1.17"
24
+ spec.add_development_dependency "rake", "~> 13.0"
25
25
  spec.add_development_dependency "rspec", "~> 3.3"
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taiwan_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Yun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-13 00:00:00.000000000 Z
11
+ date: 2020-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -42,30 +42,30 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.10'
47
+ version: '1.17'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.10'
54
+ version: '1.17'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '13.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '13.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -123,8 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  requirements: []
126
- rubyforge_project:
127
- rubygems_version: 2.7.6
126
+ rubygems_version: 3.1.2
128
127
  signing_key:
129
128
  specification_version: 4
130
129
  summary: Collection of useful custom validators in Taiwan for Rails applications