yob-abn 1.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/abn.rb +3 -4
- metadata +1 -1
data/lib/abn.rb
CHANGED
@@ -2,7 +2,7 @@ class ABN
|
|
2
2
|
|
3
3
|
class Version #:nodoc:
|
4
4
|
Major = 1
|
5
|
-
Minor =
|
5
|
+
Minor = 1
|
6
6
|
Tiny = 0
|
7
7
|
|
8
8
|
String = [Major, Minor, Tiny].join('.')
|
@@ -26,12 +26,11 @@ class ABN
|
|
26
26
|
|
27
27
|
weights = [10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
|
28
28
|
sum = 0
|
29
|
-
|
30
|
-
|
29
|
+
(0..10).each do |idx|
|
30
|
+
c = abn[idx,1]
|
31
31
|
idx == 0 ? sub = 1 : sub = 0
|
32
32
|
digit = c.to_i - sub
|
33
33
|
sum += weights[idx] * digit
|
34
|
-
idx += 1
|
35
34
|
end
|
36
35
|
|
37
36
|
sum % 89 == 0 ? true : false
|