Skip to content

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
Copy link

@Bom123789 Bom123789 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test/test_ipaddr.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants