[前][次][番号順一覧][スレッド一覧]

ruby-changes:10673

From: akr <ko1@a...>
Date: Wed, 11 Feb 2009 17:13:25 +0900 (JST)
Subject: [ruby-changes:10673] Ruby:r22236 (trunk): rdoc update.

akr	2009-02-11 17:13:20 +0900 (Wed, 11 Feb 2009)

  New Revision: 22236

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22236

  Log:
    rdoc update.

  Modified files:
    trunk/ext/socket/lib/socket.rb

Index: ext/socket/lib/socket.rb
===================================================================
--- ext/socket/lib/socket.rb	(revision 22235)
+++ ext/socket/lib/socket.rb	(revision 22236)
@@ -595,10 +595,18 @@
   #
   # 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
       st = File.lstat(path)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]