diff --git a/lib/spanish_vat_validators.rb b/lib/spanish_vat_validators.rb index 6d0b63e..b60af81 100644 --- a/lib/spanish_vat_validators.rb +++ b/lib/spanish_vat_validators.rb @@ -37,11 +37,11 @@ def validate_cif(v) [1,3,5,7].collect do |cont| xxx = (2 * texto[cont,1].to_i).to_s + "0" impares += xxx[0,1].to_i + xxx[1,1].to_i - pares += texto[cont+1,1].to_i end - xxx = (2 * texto[8,1].to_i).to_s + "0" - impares += xxx[0,1].to_i + xxx[1,1].to_i + [2,4,6].collect do |cont| + pares += texto[cont,1].to_i + end suma = (pares + impares).to_s unumero = suma.last.to_i diff --git a/lib/spanish_vat_validators/version.rb b/lib/spanish_vat_validators/version.rb index e2c0685..85a73ef 100644 --- a/lib/spanish_vat_validators/version.rb +++ b/lib/spanish_vat_validators/version.rb @@ -1,3 +1,3 @@ module SpanishVatValidators - VERSION = "0.0.4" + VERSION = "0.0.5" end