Sha256: a22c7903de7a5cad0c34b7b57b51b2e882a3ec9a15b45cd1e38fd0f81d8bf21f

Contents?: true

Size: 575 Bytes

Versions: 2

Compression:

Stored size: 575 Bytes

Contents

module Vindetta
  class Validator
    def self.vin(vin)
      return false unless vin.length == Vindetta::VIN_LENGTH

      Calculator.check_digit(vin) == Decoder.vin(vin)[:check_digit]
    rescue Calculator::InvalidCharacterError
        false
    end

    def self.wmi(wmi)
      return false unless wmi.length == Vindetta::WMI_LENGTH

      true
    end

    def self.vds(vds)
      return false unless vds.length == Vindetta::VDS_LENGTH

      true
    end

    def self.vis(vis)
      return false unless vis.length == Vindetta::VIS_LENGTH

      true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vindetta-0.24.0 lib/vindetta/validator.rb
vindetta-0.23.0 lib/vindetta/validator.rb