summaryrefslogtreecommitdiff
path: root/ext/socket/lib
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-11 08:13:20 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-11 08:13:20 +0000
commitd27c1748cd5d41fcf286545d34d7891516dc5e68 (patch)
tree5a228a939ef7c073776e5f57508a31beae8635cd /ext/socket/lib
parent630e4ef492b5647bae57d00fffa2004b7ececfc8 (diff)
rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/lib')
-rw-r--r--ext/socket/lib/socket.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb
index a207d5a..9b2ee15 100644
--- a/ext/socket/lib/socket.rb
+++ b/ext/socket/lib/socket.rb
@@ -595,9 +595,17 @@ class Socket
#
# It returns a listening socket.
#
+ # If a block is given, it is called with the socket and the block value is returned.
+ # When the block exits, the socket is closed and the socket file is removed.
+ #
# socket = Socket.unix_server_socket("/tmp/s")
- # p socket #=> #<Socket:fd 3>
- # p socket.local_address #=> #<Addrinfo: /tmp/s SOCK_STREAM>
+ # p socket #=> #<Socket:fd 3>
+ # p socket.local_address #=> #<Addrinfo: /tmp/s SOCK_STREAM>
+ #
+ # Socket.unix_server_socket("/tmp/sock") {|s|
+ # p s #=> #<Socket:fd 3>
+ # p s.local_address #=> # #<Addrinfo: /tmp/sock SOCK_STREAM>
+ # }
#
def self.unix_server_socket(path)
begin