Burocracia::CEP
The CEP module offers methods to validate, generate and format Brazilian post codes.
Constants
BLACKLIST = ["12345678", "87654321"]
FORMATTED_REGEX = /^[0-9]{5}-[0-9]{3}$/i
UNFORMATTED_REGEX = /^[0-9]{8}$/i
Instance methods
generate(format : Bool = false)
Generates a randomic valid CEP.
If you want to get a formatted new CEP, you can pass an argument to the format parameter.
valid?(cep : String)
Returns whether a CEP is valid or not.
NOTE: This will not fetch the CEP in the Correios database to check the existance.