-
-
Notifications
You must be signed in to change notification settings - Fork 62
Fix warning on nil comparison #307
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
Conversation
This uses the more efficient /regex/.match?(value) syntax that also doesn't raise any warning if id is nil.
@chris1984 are you sure the change didn't cause those test failures? |
Blah, I did not mean to hit merge, was adding that I would start testing it with the quick responses and my browser crashed. Let me revert and test it, if it's not related we can remerge. Acked it based on the code looking fine at a first glance. |
I believe this change is causing errors in Foreman's test suite. |
Can you elaborate? |
This change introduces the following error, when running the tests on
We are encountering this error when client.servers.get is called on an Integer (here). |
That could be related, but previously that also generated a warning I think. A better check is probably |
Expanding on that: it was a bug before anyway on modern Ruby anyway: $ pry
[1] pry(main)> 5 =~ /a/
NoMethodError: undefined method `=~' for an instance of Integer (NoMethodError)
from (pry):1:in `__pry__' IIRC Ruby 3.0 already displayed a deprecation warning and this was trying to address it. I'll submit a PR. |
This uses the more efficient /regex/.match?(value) syntax that also doesn't raise any warning if id is nil.