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

ruby-changes:28107

From: akr <ko1@a...>
Date: Sat, 6 Apr 2013 22:16:48 +0900 (JST)
Subject: [ruby-changes:28107] akr:r40159 (trunk): * lib/resolv.rb (Resolv::DNS.fetch_resource): New method to obtain

akr	2013-04-06 22:16:36 +0900 (Sat, 06 Apr 2013)

  New Revision: 40159

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

  Log:
    * lib/resolv.rb (Resolv::DNS.fetch_resource): New method to obtain
      full result.
      [ruby-dev:43587] [Feature #4788] proposed by Makoto Kishimoto.

  Modified files:
    trunk/ChangeLog
    trunk/NEWS
    trunk/lib/resolv.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40158)
+++ ChangeLog	(revision 40159)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Apr  6 22:12:01 2013  Tanaka Akira  <akr@f...>
+
+	* lib/resolv.rb (Resolv::DNS.fetch_resource): New method to obtain
+	  full result.
+	  [ruby-dev:43587] [Feature #4788] proposed by Makoto Kishimoto.
+
 Sat Apr  6 20:17:51 2013  Tanaka Akira  <akr@f...>
 
 	* ext/socket/socket.c (rsock_sys_fail_raddrinfo): Renamed from
Index: lib/resolv.rb
===================================================================
--- lib/resolv.rb	(revision 40158)
+++ lib/resolv.rb	(revision 40159)
@@ -506,6 +506,12 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L506
     # #getresource for argument details.
 
     def each_resource(name, typeclass, &proc)
+      fetch_resource(name, typeclass) {|reply, reply_name|
+        extract_resources(reply, reply_name, typeclass, &proc)
+      }
+    end
+
+    def fetch_resource(name, typeclass)
       lazy_initialize
       requester = make_udp_requester
       senders = {}
@@ -532,7 +538,7 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L538
               # response will not fit in an untruncated UDP packet.
               redo
             else
-              extract_resources(reply, reply_name, typeclass, &proc)
+              yield(reply, reply_name)
             end
             return
           when RCode::NXDomain
Index: NEWS
===================================================================
--- NEWS	(revision 40158)
+++ NEWS	(revision 40159)
@@ -46,6 +46,10 @@ with all sufficient information, see the https://github.com/ruby/ruby/blob/trunk/NEWS#L46
     * Pathname#write
     * Pathname#binwrite
 
+* Resolv
+  * New methods:
+    * Resolv::DNS.fetch_resource
+
 * Rinda::RingServer, Rinda::RingFinger
   * Rinda now supports multicast sockets.  See Rinda::RingServer and
     Rinda::RingFinger for details.

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

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