Use 'unless' instead of 'if not'

bug/bundler_fix
James Lee 2014-01-09 16:01:58 -06:00
parent 7cb6836209
commit ba252ec0c3
No known key found for this signature in database
GPG Key ID: 2D6094C7CEA0A321
1 changed files with 3 additions and 3 deletions

View File

@ -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