Conditions | 3 |
Total Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | # frozen_string_literal: true |
||
11 | def validate_each(record, attribute, value) |
||
12 | country_field = options[:country] ? record[options[:country]] : "[A-Z]{2}" |
||
13 | record.errors.add(attribute, :invalid_format) unless /^[A-Z]{4}#{country_field}[0-9A-Z]{2}([0-9A-Z]{3})?$/.match? value.upcase |
||
14 | end |
||
15 | end |
||
18 |