-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistent return values #43
Comments
The one option that does make sense to me would be to add |
If it only ever returns one message, does it really need to be an array? I think that introduces confusion in that, if I see an array with only one element, I assume that if there were more than one problem, they'd all be listed there. So how about making |
I definitely see your logic. I like the idea of only returning a single type (e.g. bool, array) rather than having to do a In the interest of compatibility I think it makes sense to just leave the original method as is and add a single |
@alexdunae, What do you think of making the
|
I think it would probably be better as a module method at the gem root. Monkey patching core classes is just asking for trouble. If people want it you could include that code in the README, but lots of people won't want it. Dialect // 778-992-2229 // dialect.ca
|
This has bothered by for a long time: https://github.com/validates-email-format-of/validates_email_format_of/blob/master/lib/validates_email_format_of.rb#L68
The method either returns
nil
(for success!) or an array with a single element, the message. It was a design mistake long ago that would be wonderful to fix one day. I'm not sure how without breaking compatibility. Maybe a 2.0 down the road. It should either always return a bool, or always return an array.Anyway, one day...
The text was updated successfully, but these errors were encountered: