Sha256: df84701e38a473d51f2a86703e98063b54c00075b1a18b697603027048941357

Contents?: true

Size: 329 Bytes

Versions: 3

Compression:

Stored size: 329 Bytes

Contents

class BicValidator < ActiveModel::EachValidator

  def validate_each(record, attribute, value)
    record_error(record, attribute, value) unless BankValidator::Bic.new(value).valid?
  end
  
  private
  
  def record_error(record, attribute, value)
    record.errors.add(attribute, (options[:message] || :invalid_bic))
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bank-validator-0.3.2 lib/active_model/bic_validator.rb
bank-validator-0.3.1 lib/active_model/bic_validator.rb
bank-validator-0.3.0 lib/active_model/bic_validator.rb