za_id_number 1.0.1 → 2.0.0

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: cdb2d0956f5a0db41e437bb513351f9cc73196d3eff0178dc5e7f3ae9e00dcaa
4
- data.tar.gz: 721e6eede04972e0f63222780ae035ac3e5b35ecb5a6ecae04c9b4e56a1b33a1
3
+ metadata.gz: 4ed3ce4b45b45da798697e7c5f48873752f53b6c12fc07ec985805d5acfe1190
4
+ data.tar.gz: 7e14ac75dc6ab6a710be4d3dc9a261a066515d1ac53522fe4a2b2d4c510eeed8
5
5
  SHA512:
6
- metadata.gz: 35a73023eb8f230045d10b7437a3e47214713f798492a42fe1c8bd6ef740df19cc78ffd3238572499ac3932fe060eb5c41b49761f36c8eb25da471533e0285d8
7
- data.tar.gz: dc1a9468dc5f0215b139256b97c7ee2af49b217490bfa622080bc81e7a15112d08149b08f98f5afa769e2aa754b3840f79e18e55eacb9ab08d00356512184315
6
+ metadata.gz: 327d332579085ea13569812f310e577f280677726635e2df2493e545c4123aea8ba5b59408fc7ed0c40b97bcc9a6c3842a822c516fd352b5faaf0acb2bd8bf55
7
+ data.tar.gz: f7706ab08495208b569734ad6910ae90e4abbc82255fec79b32c202f865d88f6d7fd2a12c1e0843745bc86ea6e2db89bd4a69f6ace55038c34f2b7412645b7e1
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.5.7
data/README.md CHANGED
@@ -52,11 +52,11 @@ id_number = ZAIDNumber.new('7501151234085') # => #<ZAIDNumber:0x00d40 @id_number
52
52
  ### Validation checks
53
53
 
54
54
  ```ruby
55
- id_num.has_valid_length? # => true
56
- id_num.has_only_digits? # => true
57
- id_num.has_valid_date? # => true
58
- id_num.has_valid_citizenship? # => true
59
- id_num.has_valid_checksum? # => true
55
+ id_num.valid_length? # => true
56
+ id_num.only_digits? # => true
57
+ id_num.valid_date? # => true
58
+ id_num.valid_citizenship? # => true
59
+ id_num.valid_checksum? # => true
60
60
  ```
61
61
 
62
62
  Or, roll up all those validation checks into one call:
data/lib/za_id_number.rb CHANGED
@@ -17,30 +17,30 @@ class ZAIDNumber
17
17
  end
18
18
 
19
19
  def valid?
20
- has_valid_length? &&
21
- has_only_digits? &&
22
- has_valid_date? &&
23
- has_valid_citizenship? &&
24
- has_valid_checksum?
20
+ valid_length? &&
21
+ only_digits? &&
22
+ valid_date? &&
23
+ valid_citizenship? &&
24
+ valid_checksum?
25
25
  end
26
26
 
27
- def has_valid_checksum?
27
+ def valid_checksum?
28
28
  Luhn.valid? @id_number
29
29
  end
30
30
 
31
- def has_valid_length?
31
+ def valid_length?
32
32
  @id_number.length == REQUIRED_ID_LENGTH
33
33
  end
34
34
 
35
- def has_only_digits?
35
+ def only_digits?
36
36
  @id_number.to_s.gsub(/\D*/, '') == @id_number.to_s
37
37
  end
38
38
 
39
- def has_valid_date?
39
+ def valid_date?
40
40
  date_of_birth ? true : false
41
41
  end
42
42
 
43
- def has_valid_citizenship?
43
+ def valid_citizenship?
44
44
  CITIZENSHIP_RANGE.include? @id_number[10].to_i
45
45
  end
46
46
 
@@ -1,5 +1,5 @@
1
1
  class ZAIDNumber
2
2
  class Version
3
- VERSION = '1.0.1'
3
+ VERSION = '2.0.0'
4
4
  end
5
5
  end
data/za_id_number.gemspec CHANGED
@@ -32,9 +32,9 @@ Gem::Specification.new do |spec|
32
32
  spec.require_paths = ["lib"]
33
33
 
34
34
  spec.add_development_dependency 'bundler', '~> 1.13'
35
- spec.add_development_dependency 'rake', '~> 10.0'
35
+ spec.add_development_dependency 'rake', '~> 13.0.3'
36
36
  spec.add_development_dependency 'rspec', '~> 3.0'
37
- spec.add_development_dependency 'pry', '~> 0.11.3'
37
+ spec.add_development_dependency 'pry', '~> 0.14.0'
38
38
  spec.add_development_dependency 'awesome_print', '~> 1.8'
39
39
 
40
40
  spec.add_dependency 'luhn', '~> 1.0', '>= 1.0.2'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: za_id_number
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Fortuna
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-04 00:00:00.000000000 Z
11
+ date: 2021-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 13.0.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 13.0.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.11.3
61
+ version: 0.14.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: 0.11.3
68
+ version: 0.14.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: awesome_print
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -110,6 +110,7 @@ extra_rdoc_files: []
110
110
  files:
111
111
  - ".gitignore"
112
112
  - ".rspec"
113
+ - ".tool-versions"
113
114
  - ".travis.yml"
114
115
  - CODE_OF_CONDUCT.md
115
116
  - Gemfile
@@ -126,7 +127,7 @@ homepage: http://www.zero-one.io
126
127
  licenses:
127
128
  - MIT
128
129
  metadata: {}
129
- post_install_message:
130
+ post_install_message:
130
131
  rdoc_options: []
131
132
  require_paths:
132
133
  - lib
@@ -141,9 +142,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
142
  - !ruby/object:Gem::Version
142
143
  version: '0'
143
144
  requirements: []
144
- rubyforge_project:
145
- rubygems_version: 2.7.3
146
- signing_key:
145
+ rubygems_version: 3.2.14
146
+ signing_key:
147
147
  specification_version: 4
148
148
  summary: A small library for parsing South African ID numbers
149
149
  test_files: []