summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-21 23:50:25 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-21 23:50:25 +0000
commit0514a747941e8e03fcfb154ad32bf880ea95011a (patch)
tree13d529c7d37ae96fa8b32243d33b7ae998e37a96 /ext/socket
parente3c288569833b6777e7ecc0bbc26f8e6ca8f2ba7 (diff)
socket: use symbol proc for IO#close loops
Made possible by r56795, this reduces human and byte code size. * ext/socket/lib/socket.rb (self.ip_sockets_port0, self.tcp_server_sockets_port0, self.tcp_server_sockets, self.udp_server_sockets): use symbol proc git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/lib/socket.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb
index 35a10de..42c7edd 100644
--- a/ext/socket/lib/socket.rb
+++ b/ext/socket/lib/socket.rb
@@ -675,10 +675,10 @@ class Socket < BasicSocket
end
}
rescue Errno::EADDRINUSE
- sockets.each {|s| s.close }
+ sockets.each(&:close)
retry
rescue Exception
- sockets.each {|s| s.close }
+ sockets.each(&:close)
raise
end
sockets
@@ -695,7 +695,7 @@ class Socket < BasicSocket
s.listen(Socket::SOMAXCONN)
}
rescue Exception
- sockets.each {|s| s.close }
+ sockets.each(&:close)
raise
end
sockets
@@ -758,7 +758,7 @@ class Socket < BasicSocket
raise last_error
end
rescue Exception
- sockets.each {|s| s.close }
+ sockets.each(&:close)
raise
end
end
@@ -766,7 +766,7 @@ class Socket < BasicSocket
begin
yield sockets
ensure
- sockets.each {|s| s.close }
+ sockets.each(&:close)
end
else
sockets
@@ -927,7 +927,7 @@ class Socket < BasicSocket
begin
yield sockets
ensure
- sockets.each {|s| s.close } if sockets
+ sockets.each(&:close) if sockets
end
else
sockets