Sha256: c888160818b8199d0ac6e0e2e07b71fb7b5f85e72c7cff02876caefc68c50c3b
Contents?: true
Size: 356 Bytes
Versions: 3
Compression:
Stored size: 356 Bytes
Contents
require 'active_model' class BicValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record_error(record, attribute, value) unless value =~ regexp end private def record_error(record, attribute, value) record.errors.add(attribute, :invalid_bic) end def regexp /[A-Z]{6}[A-Z0-9]{2,}/ end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bank-validator-0.2.1 | lib/active_model/bic_validator.rb |
bank-validator-0.2.0 | lib/active_model/bic_validator.rb |
bank-validator-0.1.0 | lib/active_model/bic_validator.rb |