Sha256: d4a095645d1eaf9730a11a09f2733afbb9727358ea76c6166ec96c03a576c535

Contents?: true

Size: 326 Bytes

Versions: 1

Compression:

Stored size: 326 Bytes

Contents

require 'active_model'

module Vindetta
  class Validator < ActiveModel::Validator
    LENGTH = 17

    def self.run(value)
      Vin.new(value).valid?
    end

    def validate(record)
      if record.value.length != LENGTH
        record.errors.add(:value, "Invalid Length") # TODO: Move to I18n
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vindetta-0.7.0 lib/vindetta/validator.rb