| Total Complexity | 6 |
| Total Lines | 13 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | # frozen_string_literal: true |
||
| 10 | class IbanValidator < ActiveModel::EachValidator |
||
| 11 | def validate_each(record, attribute, value) |
||
| 12 | if !IbanBic.parse(value) |
||
| 13 | record.errors.add(attribute, :invalid_format) |
||
| 14 | elsif !IbanBic.valid_check?(value) |
||
| 15 | record.errors.add(attribute, :invalid_check) |
||
| 16 | elsif !IbanBic.valid_country_check?(value) |
||
| 17 | record.errors.add(attribute, :invalid_country_check) |
||
| 18 | elsif options[:tags] && !IbanBic.has_tags?(value, options[:tags]) |
||
| 19 | record.errors.add(attribute, :invalid_tag) |
||
| 20 | end |
||
| 21 | end |
||
| 22 | end |
||
| 23 | end |
||
| 25 |