Skip to content

Instantly share code, notes, and snippets.

@leotada
Created September 6, 2022 14:26
Show Gist options
  • Save leotada/6b96a6695ab25addb93371f47fa5445f to your computer and use it in GitHub Desktop.
Save leotada/6b96a6695ab25addb93371f47fa5445f to your computer and use it in GitHub Desktop.
document class
class Document
def initialize(document)
@document = document
end
def raw
@document
end
def is_cnpj?
true
end
def is_cpf?
false
end
def root
@document.split('/')[0]
end
def pretty
'18.659.556/0001-50'
end
def digits
'18659556000150'
end
end
doc = Document.new('18.659.556/0001-50')
puts doc.raw
puts doc.is_cnpj?
puts doc.is_cpf?
puts doc.root
puts doc.pretty
puts doc.digits
@joaotorquato
Copy link

Exatamente como fizemos no PR: https://github.com/joaotorquato/cashu/pull/804/files
A questão acredito ser outra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment