class Vindetta::Validator

Attributes

standard[R]

Public Class Methods

new(standard) click to toggle source
# File lib/vindetta/validator.rb, line 7
def initialize(standard)
  @standard = standard
end

Public Instance Methods

vds(vds) click to toggle source
# File lib/vindetta/validator.rb, line 23
def vds(vds)
  vds.length == standard.vds.length
end
vin(vin) click to toggle source
# File lib/vindetta/validator.rb, line 11
def vin(vin)
  return false unless vin.length == standard.length

  Calculator.check_digit(vin) == Decoder.new(Vindetta::Standard::ISO3779).vin(vin)[:check_digit]
rescue Calculator::InvalidCharacterError
  false
end
vis(vis) click to toggle source
# File lib/vindetta/validator.rb, line 27
def vis(vis)
  vis.length == standard.vis.length
end
wmi(wmi) click to toggle source
# File lib/vindetta/validator.rb, line 19
def wmi(wmi)
  wmi.length == standard.wmi.length
end