Use 'unless' instead of 'if not'
parent
7cb6836209
commit
ba252ec0c3
|
@ -190,11 +190,11 @@ module Socket
|
||||||
# Rubinius has a bug where gethostbyname returns dotted quads instead of
|
# Rubinius has a bug where gethostbyname returns dotted quads instead of
|
||||||
# NBO, but that's what we want anyway, so just short-circuit here.
|
# NBO, but that's what we want anyway, so just short-circuit here.
|
||||||
if res[0] =~ MATCH_IPV4 || res[0] =~ MATCH_IPV6
|
if res[0] =~ MATCH_IPV4 || res[0] =~ MATCH_IPV6
|
||||||
if !accept_ipv6
|
unless accept_ipv6
|
||||||
res.reject!{ |ascii| ascii =~ MATCH_IPV6 }
|
res.reject!{ |ascii| ascii =~ MATCH_IPV6 }
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if !accept_ipv6
|
unless accept_ipv6
|
||||||
res.reject!{ |nbo| nbo.length != 4 }
|
res.reject!{ |nbo| nbo.length != 4 }
|
||||||
end
|
end
|
||||||
res.map!{ |nbo| self.addr_ntoa(nbo) }
|
res.map!{ |nbo| self.addr_ntoa(nbo) }
|
||||||
|
@ -593,7 +593,7 @@ module Socket
|
||||||
#
|
#
|
||||||
def self.ipv6_link_address(intf)
|
def self.ipv6_link_address(intf)
|
||||||
r = source_address("FF02::1%#{intf}")
|
r = source_address("FF02::1%#{intf}")
|
||||||
return if !(r and r =~ /^fe80/i)
|
return nil if r.nil? || r !~ /^fe80/i
|
||||||
r
|
r
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue