lib/vindetta/validator.rb in vindetta-0.25.0 vs lib/vindetta/validator.rb in vindetta-0.26.0
- old
+ new
@@ -1,35 +1,31 @@
+# frozen_string_literal: true
+
module Vindetta
class Validator
attr_reader :standard
def initialize(standard)
@standard = standard
end
def vin(vin)
- return false unless vin.length == standard::LENGTH
+ return false unless vin.length == standard.length
Calculator.check_digit(vin) == Decoder.new(Vindetta::Standard::ISO3779).vin(vin)[:check_digit]
rescue Calculator::InvalidCharacterError
- false
+ false
end
def wmi(wmi)
- return false unless wmi.length == standard.wmi.length
-
- true
+ wmi.length == standard.wmi.length
end
def vds(vds)
- return false unless vds.length == standard.vds.length
-
- true
+ vds.length == standard.vds.length
end
def vis(vis)
- return false unless vis.length == standard.vis.length
-
- true
+ vis.length == standard.vis.length
end
end
end