elfproef 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/elfproef/bsn_validator.rb +6 -5
- data/lib/elfproef/version.rb +1 -1
- metadata +11 -11
@@ -26,16 +26,17 @@ class BsnValidator < ActiveModel::EachValidator
|
|
26
26
|
# Make sure we have 9 digits
|
27
27
|
number = "0#{number}" if number.size == 8
|
28
28
|
|
29
|
-
numbers = number.split("").map(&:to_i)
|
30
|
-
control, numbers = numbers.pop, numbers.reverse
|
31
|
-
|
29
|
+
numbers = number.split("").map(&:to_i).reverse
|
32
30
|
|
33
31
|
sum = 0
|
34
32
|
numbers.each_with_index do |digit, i|
|
35
|
-
|
33
|
+
# The first digit is * -1, the rest
|
34
|
+
# counts from 2 up.
|
35
|
+
i = i == 0 ? -1 : i+1
|
36
|
+
sum += digit * i
|
36
37
|
end
|
37
38
|
|
38
|
-
sum
|
39
|
+
sum % 11 == 0
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
data/lib/elfproef/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elfproef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ date: 2012-03-14 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
17
|
-
requirement: &
|
17
|
+
requirement: &70120115123800 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70120115123800
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rspec
|
28
|
-
requirement: &
|
28
|
+
requirement: &70120115121940 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70120115121940
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: guard-rspec
|
39
|
-
requirement: &
|
39
|
+
requirement: &70120115121320 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70120115121320
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: activemodel
|
50
|
-
requirement: &
|
50
|
+
requirement: &70120115115360 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,7 +55,7 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70120115115360
|
59
59
|
description: Validation for Dutch bank account numbers and Citizen Service Numbers
|
60
60
|
(BSN)
|
61
61
|
email:
|
@@ -93,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
segments:
|
95
95
|
- 0
|
96
|
-
hash: -
|
96
|
+
hash: -1005749835368650019
|
97
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
98
|
none: false
|
99
99
|
requirements:
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
version: '0'
|
103
103
|
segments:
|
104
104
|
- 0
|
105
|
-
hash: -
|
105
|
+
hash: -1005749835368650019
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project: elfproef
|
108
108
|
rubygems_version: 1.8.11
|