validator-nric 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3d2261299c9420bd15c70344beee9816fcfa6a2
4
- data.tar.gz: 4de48ec5f800036bb0b03d789e4f6db96903a31c
3
+ metadata.gz: 4519cfffee6a44ba64c924238e8e340a101896a5
4
+ data.tar.gz: 9d6e02d7ac78bab245af14d9c2a3b790975b7458
5
5
  SHA512:
6
- metadata.gz: 8f1b4f96be687f9257aa076b12c334af8a67fb992b356bd09092ad47bd8c669099aa6697522ac00ab3d063dce25857fd9fc3e890e052e03e1f098063b87dd95d
7
- data.tar.gz: 594a8c6e2a3b833ac89f3e74313fec00161dedc258b9ac4ba29282e751a5a4825b91d7fbdc65dc94b8f868b74c5e4606aa882368c1910ca6a94360fe2854a7db
6
+ metadata.gz: 1e699c33aaa09b4dcdab9c5d0869cceed42faca104a0e0f0272e5f1e9a204770641d1270879df4077e3cca9e0519303d33f68cd199bd215488731481085c78e0
7
+ data.tar.gz: 3d6d44c196a58ef6fc1753e5402d5beb48cd708bebd2b9952f1621e2fc692d8309057bd7f032af22c012c0ea339bdc1e0d251c083fd0d45d03e1b372b0f97d86
@@ -5,3 +5,6 @@ AllCops:
5
5
 
6
6
  Documentation:
7
7
  Enabled: false
8
+
9
+ Metrics/BlockLength:
10
+ Max: 50
@@ -12,7 +12,7 @@ module Validator
12
12
  module_function
13
13
 
14
14
  # The multiplier for each individual digit
15
- WEIGHT = [2, 7, 6, 5, 4, 3, 2]
15
+ WEIGHT = [2, 7, 6, 5, 4, 3, 2].freeze
16
16
 
17
17
  # Century prefix lookup tables
18
18
  #
@@ -23,10 +23,10 @@ module Validator
23
23
  #
24
24
  # Notice the it is backward of ABCDEFGHIZJ
25
25
  # For T and G, there is a shift of 4 places
26
- S_TABLE = %w(J Z I H G F E D C B A)
27
- T_TABLE = %w(G F E D C B A J Z I H)
28
- F_TABLE = %w(X W U T R Q P N M L K)
29
- G_TABLE = %w(R Q P N M L K X W U T)
26
+ S_TABLE = %w(J Z I H G F E D C B A).freeze
27
+ T_TABLE = %w(G F E D C B A J Z I H).freeze
28
+ F_TABLE = %w(X W U T R Q P N M L K).freeze
29
+ G_TABLE = %w(R Q P N M L K X W U T).freeze
30
30
 
31
31
  def mod(value)
32
32
  ic_array = value.each_char.map(&:to_i)
@@ -39,7 +39,7 @@ module Validator
39
39
 
40
40
  def check(nric)
41
41
  return false if nric.nil? || nric.size != 9
42
- nric.upcase!
42
+ nric = nric.upcase
43
43
  return false unless %w(S T F G).include?(nric[0])
44
44
 
45
45
  century_prefix = nric[0, 1]
@@ -1,5 +1,5 @@
1
1
  module Validator
2
2
  module Nric
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'.freeze
4
4
  end
5
5
  end
@@ -87,5 +87,4 @@ RSpec.configure do |config|
87
87
  # test failures related to randomization by passing the same `--seed` value
88
88
  # as the one that triggered the failure.
89
89
  Kernel.srand config.seed
90
-
91
90
  end
@@ -1,5 +1,4 @@
1
1
  RSpec.describe Validator::Nric do
2
-
3
2
  describe 'check' do
4
3
  it 'returns false if nric is nil' do
5
4
  expect(subject.check(nil)).to be false
@@ -40,5 +39,4 @@ RSpec.describe Validator::Nric do
40
39
  expect(subject.lookup('S', 10)).to eq 'A'
41
40
  end
42
41
  end
43
-
44
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validator-nric
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mech
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-11 00:00:00.000000000 Z
11
+ date: 2017-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -106,11 +106,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.4.2
109
+ rubygems_version: 2.6.10
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Validates Singapore NRIC
113
113
  test_files:
114
114
  - spec/spec_helper.rb
115
115
  - spec/validator/nric_spec.rb
116
- has_rdoc: