Burocracia::CPF
The CPF module offers methods to validate, generate and format Brazilian CPFs.
Constants
BLACKLIST = ["12345678901", "1235678999", "12345678900"]
FORMATTED_REGEX = /^[0-9]{3}.[0-9]{3}.[0-9]{3}-[0-9]{2}$/i
UNFORMATTED_REGEX = /^[0-9]{11}$/i
Instance methods
generate(format : Bool = false)
Generates a randomic valid CPF.
If you want to get a formatted new CPF, you can pass an argument to the format parameter.
valid?(cpf : String)
Returns whether a CPF is valid or not.
NOTE: This will not fetch the CPF in the Receita Federal database to check the existance.