yob-abn 1.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/abn.rb +3 -4
  2. 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 = 0
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
- idx = 0
30
- abn.each_char do |c|
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yob-abn
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.0"
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Healy