Closed rafaelbpa closed 6 years ago
What's the document number you're using?
I am using CPF.valid?(777), for example. This should return false, am I right? But is returning nil.
This should return false, am I right?
No, you're not. Predicate methods are not required to return booleans. nil
is a falsy value, so all you have to do is not checking for data type. If type is important to you, you can coerce it in your code like !!CPF.valid?(777)
.
Worked for me. Thank you, Fernando!
I'm using version 0.4.1 and method .valid? is always return nil
Rails 3.2.21 and ruby 2.1.5p273