validates_iban 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/iban_validator.rb +4 -6
- data/lib/validates_iban/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abba868d56a32e2489832c984af04473b1a148bb
|
4
|
+
data.tar.gz: 89f4ad424096d3307586db82e2040fa87e1d1eb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b13ceae394d7522f4c9643dd0523b73d687d380bf3a31b861d75c874015af570ea511cd11e60049df596500958aa9a10cda47ccd318a2bb259bdd4ce5b58260
|
7
|
+
data.tar.gz: 6cf97e93a423f9651523c4687e5b73544add65149e81be08149406b880232a819fd470ab0de92f1546c8573d5d2e793826172ccccd0eb04b7a2a4b32fbee0985
|
data/lib/iban_validator.rb
CHANGED
@@ -2,13 +2,11 @@ require "iban-tools"
|
|
2
2
|
|
3
3
|
class IbanValidator < ActiveModel::EachValidator
|
4
4
|
def validate_each(object, attribute, value)
|
5
|
-
|
6
|
-
|
7
|
-
validation_errors = iban.validation_errors
|
5
|
+
iban = IBANTools::IBAN.new(value)
|
6
|
+
validation_errors = iban.validation_errors
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
end
|
8
|
+
unless validation_errors.empty?
|
9
|
+
object.errors[attribute] << (options[:message] || "is not a valid IBAN string: #{validation_errors.join(", ")}")
|
12
10
|
end
|
13
11
|
end
|
14
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validates_iban
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kasper Johansen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|