fnando / cpf_cnpj

🇧🇷 Validate, generate and format CPF/CNPJ numbers. Include command-line tools.
MIT License
238 stars 42 forks source link

Change cpf.valid? to return false rather than nil when invalid #4

Closed lucassch closed 8 years ago

fnando commented 8 years ago

Why do you think returning false instead of nil will make a difference?

lucassch commented 8 years ago

methods with ? shouldn't return Boolean?

fnando commented 8 years ago

Not really. It must return a value that can be evaluated to true/false. Numeric#nonzero?, for instance, returns the number when is greater than zero.

100.nonzero?
#=> 100

0.nonzero?
#=> nil