[Groonga-commit] droonga/droonga-client-ruby at 6e37e63 [master] Extract send and receive communication pattern

Back to archive index

Yoji Shidara null+****@clear*****
Wed Sep 11 14:19:21 JST 2013


Yoji Shidara	2013-09-11 14:19:21 +0900 (Wed, 11 Sep 2013)

  New Revision: 6e37e63b57903eb2c6595e1b372954443cedd73f
  https://github.com/droonga/droonga-client-ruby/commit/6e37e63b57903eb2c6595e1b372954443cedd73f

  Message:
    Extract send and receive communication pattern

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

  Modified: lib/droonga/connection/droonga_protocol.rb (+14 -8)
===================================================================
--- lib/droonga/connection/droonga_protocol.rb    2013-09-11 14:02:03 +0900 (ff4f904)
+++ lib/droonga/connection/droonga_protocol.rb    2013-09-11 14:19:21 +0900 (5d37d09)
@@ -32,16 +32,22 @@ module Droonga
       end
 
       def search(body)
+        envelope = {
+          "id"         => Time.now.to_f.to_s,
+          "date"       => Time.now,
+          "statusCode" => 200,
+          "type"       => "search",
+          "body"       => body,
+          "dataset"    => "Taiyaki"
+        }
+        send_receive(envelope)
+      end
+
+      def send_receive(envelope)
         receiver = Receiver.new
         begin
-          envelope = {
-            "id"         => Time.now.to_f.to_s,
-            "date"       => Time.now,
-            "replyTo"    => "#{receiver.host}:#{receiver.port}/droonga",
-            "statusCode" => 200,
-            "type"       => "search",
-            "body"       => body,
-          }
+          envelope = envelope.dup
+          envelope["replyTo"] = "#{receiver.host}:#{receiver.port}/droonga"
           @logger.post("message", envelope)
           receiver.receive(:timeout => @timeout)
         ensure
-------------- next part --------------
HTML����������������������������...
Download 



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