Class: EacRailsUtils::CpfValidator::Cpf

Inherits:
Object
  • Object
show all
Defined in:
app/validators/eac_rails_utils/cpf_validator.rb

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ Cpf

Returns a new instance of Cpf.


13
14
15
# File 'app/validators/eac_rails_utils/cpf_validator.rb', line 13

def initialize(input)
  @input = input
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)

17
18
19
20
21
# File 'app/validators/eac_rails_utils/cpf_validator.rb', line 17

def valid?
  return false if input_invalid?

  digito_verificador1_calculo == values[9] && digito_verificador2_calculo == values[10]
end