Sha256: b2077afca8272d733a9196fb0a3a7939f1ecb97cb6668012ffdb6eb59c1482b9

Contents?: true

Size: 337 Bytes

Versions: 3

Compression:

Stored size: 337 Bytes

Contents

module BicValidation
  class BicValidator < ActiveModel::EachValidator
    def validate_each(record, attribute, value)
      bic = Bic.new(value)
      if bic.valid?
        unless bic.known?
          record.errors.add attribute, :unknown
        end
      else
        record.errors.add attribute, :invalid
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bic_validation-0.2.1 lib/bic_validation/bic_validator.rb
bic_validation-0.2.0 lib/bic_validation/bic_validator.rb
bic_validation-0.1.0 lib/bic_validation/bic_validator.rb