Sha256: a0f673211fab4b7f548674ff5751682583a234409ffd5f126f18176a1ee7ea6c

Contents?: true

Size: 341 Bytes

Versions: 2

Compression:

Stored size: 341 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_bic
        end
      else
        record.errors.add attribute, :invalid
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bic_validation-0.3.1 lib/bic_validation/bic_validator.rb
bic_validation-0.3.0 lib/bic_validation/bic_validator.rb