[Groonga-commit] droonga/droonga-client-ruby at 48f203a [master] Receive all responses from the Droonga Engine.

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Jan 24 12:48:59 JST 2014


YUKI Hiroshi	2014-01-24 12:48:59 +0900 (Fri, 24 Jan 2014)

  New Revision: 48f203a4140bb8feef36bc6d2b2372b61b2d0aa4
  https://github.com/droonga/droonga-client-ruby/commit/48f203a4140bb8feef36bc6d2b2372b61b2d0aa4

  Message:
    Receive all responses from the Droonga Engine.
    
    If there is only one response, receive() returns the first response. Otherwise it returns an array of all responses. Because the receiver receives only "Droonga message format" objects, we don't have to think about array responses.

  Modified files:
    lib/droonga/client/connection/droonga_protocol.rb

  Modified: lib/droonga/client/connection/droonga_protocol.rb (+9 -5)
===================================================================
--- lib/droonga/client/connection/droonga_protocol.rb    2014-01-20 16:44:26 +0900 (c98f62d)
+++ lib/droonga/client/connection/droonga_protocol.rb    2014-01-24 12:48:59 +0900 (002238c)
@@ -184,12 +184,16 @@ module Droonga
             responses = []
             receiver.receive(receive_options) do |response|
               responses << response
+              if block_given?
+                yield(response)
+              end
             end
-            response = responses.first
-            if block_given?
-              yield(response)
-            else
-              response
+            unless block_given?
+              if responses.size > 1
+                responses
+              else
+                response
+              end
             end
           ensure
             receiver.close
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index