Created
September 6, 2022 14:26
-
-
Save leotada/6b96a6695ab25addb93371f47fa5445f to your computer and use it in GitHub Desktop.
document class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exatamente como fizemos no PR: https://github.com/joaotorquato/cashu/pull/804/files
A questão acredito ser outra