Sha256: cc3829f0d5852739a12a548d4c2723a19d1e19c213ba2031562e286c33384b4d

Contents?: true

Size: 357 Bytes

Versions: 2

Compression:

Stored size: 357 Bytes

Contents

require "jan_validator/version"
require "jan"

class JanValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    record.errors.add(attribute, "is invalid length") unless Jan::Validator.validate_size(value)
    record.errors.add(attribute, "is invalid check-digit") unless Jan::Validator.validate_check_digit(value)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jan_validator-0.1.0 lib/jan_validator.rb
jan_validator-0.0.1 lib/jan_validator.rb