lib/validates_cpf/cpf.rb in validates_cpf-3.0.0 vs lib/validates_cpf/cpf.rb in validates_cpf-3.1.0
- old
+ new
@@ -12,18 +12,20 @@
end
def valid?
return true if @number.blank?
return false unless @pure_number
+
check_cpf
end
attr_reader :number
private
def check_cpf
return false if @cleaned_number.length != 11 || @cleaned_number.scan(/\d/).uniq.length == 1
+
@result == first_digit_verifier + second_digit_verifier
end
def first_digit_verifier
sum = multiply_and_sum([10, 9, 8, 7, 6, 5, 4, 3, 2], @pure_number)