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