digit_checksum 0.2.1 → 0.2.2

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: a7f4912919208a9c69e0dab3f129212f0927928d
4
- data.tar.gz: 7cb2b0ac8b917455439bb5475ae3fb9249ac0205
3
+ metadata.gz: a0bce00575ccb77cd11d4b8b8e5304eefac775d7
4
+ data.tar.gz: fa112bced8ae776bf2eb88fe1cc00f9f5c2edb5a
5
5
  SHA512:
6
- metadata.gz: 6bbfc32f461e5825cbadedb461355da5328cae98fcf060e0b6e5aafcd2e97e11116bd90c1b3b71d4ee92169fe977cf2d2f62ce9918715d138b2ef38bbe625fc1
7
- data.tar.gz: 70da514b2ca242306e9ce3d049d90fcb1808b5b27b73cf54fb11aea7ee8022a31ee207c795bce43f7b23ad3e8e171b8f1f2bbad125a7f5419e8f9a88bf941bd8
6
+ metadata.gz: 8f6c902340c35cce05da6fabbd2e8a58993e02896afe4d36f9d432af1a2e833275de9537c6b06ea96d8784d221b2a1160f994026454fe909dcc68100594f0ee8
7
+ data.tar.gz: 3617c00620985d2896eb71d9d5c314e5923c1b46c5f071adca984d73ddd119def3b00ddc7f7cc12cfded433b3a2842dc6178f0cbbdddf1c1f7bcbfcc85a4847b
data/README.md CHANGED
@@ -17,7 +17,7 @@ One of the greatest abilitys of this library is allowing to check digit checksum
17
17
  Add this line to your application's Gemfile:
18
18
 
19
19
  ```ruby
20
- gem 'digit_checksum', '~> 0.2.1'
20
+ gem 'digit_checksum', '~> 0.2.2'
21
21
  ```
22
22
 
23
23
  And then execute:
@@ -166,10 +166,12 @@ module DigitChecksum
166
166
  end
167
167
 
168
168
  def digit_verify(quotient_rest, division_factor)
169
- # thats the rule, if quotient_rest < 2, so its became 0
170
- return 0 if quotient_rest < 2
169
+ rest = (division_factor - quotient_rest).to_i
171
170
 
172
- (division_factor - quotient_rest).to_i
171
+ # if rest has two digits(checkdigit must be a single digit), force 0
172
+ return 0 if rest >= 10
173
+
174
+ rest
173
175
  end
174
176
 
175
177
  def first_verify_mask
@@ -1,3 +1,3 @@
1
1
  module DigitChecksum
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digit_checksum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Fidelis