class BrDocuments::CnpjCpf::Cpf

Private Instance Methods

format_number() click to toggle source
# File lib/br_documents/cnpj_cpf/cpf.rb, line 18
def format_number
  @number.sub(/(\d{3})(\d{3})(\d{3})(\d{2})/, '\\1.\\2.\\3-\\4')
end
format_regex() click to toggle source
# File lib/br_documents/cnpj_cpf/cpf.rb, line 10
def format_regex
  /^(\d{3}\.\d{3}\.\d{3}-\d{2})$|^(\d{11})$/
end
weights_for_digital_check() click to toggle source
# File lib/br_documents/cnpj_cpf/cpf.rb, line 14
def weights_for_digital_check
  [[10, 9, 8, 7, 6, 5, 4, 3, 2], [11, 10, 9, 8, 7, 6, 5, 4, 3, 2]]
end