Skip to content
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

==: Fix comparing '0.0.0.0'/'::' to nil #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

taketo1113
Copy link
Contributor

@taketo1113 taketo1113 commented Aug 27, 2024

It fixes comparing '0.0.0.0'/'::' to nil for == method.
IPAddr.new("0.0.0.0") == nil and nil == IPAddr.new("0.0.0.0") will return same result of false.

# IPv4
IPAddr.new("0.0.0.0") == nil
=> false

nil == IPAddr.new('0.0.0.0') 
=> false

IPAddr.new("0.0.0.0").nil?
=> false

# IPv6
IPAddr.new("::") == nil
=> false

nil == IPAddr.new("::")
=> false

IPAddr.new("::").nil?
=> false

Fix #75

@taketo1113 taketo1113 requested a review from knu as a code owner August 27, 2024 13:50
@taketo1113 taketo1113 changed the title ==: Fix comparing to nil ==: Fix comparing '0.0.0.0'/'::' to nil Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

IPAddr.new("0.0.0.0") == nil return true
1 participant