Kouhei Sutou
null+****@clear*****
Thu Jan 16 15:47:44 JST 2014
Kouhei Sutou 2014-01-16 15:47:44 +0900 (Thu, 16 Jan 2014) New Revision: 402827fa8ea1a250a29f93e90ffe8ddb12ba0a55 https://github.com/droonga/droonga-client-ruby/commit/402827fa8ea1a250a29f93e90ffe8ddb12ba0a55 Message: Rename "execute" to "shuttle" Because "shuttle" is good word to explain that sending a request and receiving one or more responses type execution. Modified files: lib/droonga/client.rb lib/droonga/client/connection/droonga_protocol.rb Modified: lib/droonga/client.rb (+13 -3) =================================================================== --- lib/droonga/client.rb 2014-01-16 15:41:14 +0900 (c075ed3) +++ lib/droonga/client.rb 2014-01-16 15:47:44 +0900 (a98f2d7) @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2013 Droonga Project +# Copyright (C) 2013-2014 Droonga Project # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -59,8 +59,18 @@ module Droonga @connection = Connection::DroongaProtocol.new(options) end - def search(body) - @connection.search(body) + def shuttle(message, &block) + @connection.shuttle(message, &block) + end + + def search(body, &block) + shuttle({ + "id" => Time.now.to_f.to_s, + "date" => Time.now, + "type" => "search", + "body" => body, + }, + &block) end # Close the connection used by the client. You can't send any Modified: lib/droonga/client/connection/droonga_protocol.rb (+10 -18) =================================================================== --- lib/droonga/client/connection/droonga_protocol.rb 2014-01-16 15:41:14 +0900 (57a4005) +++ lib/droonga/client/connection/droonga_protocol.rb 2014-01-16 15:47:44 +0900 (5664102) @@ -49,33 +49,25 @@ module Droonga @read_timeout = options[:read_timeout] end - def search(body, &block) - message = { - "id" => Time.now.to_f.to_s, - "date" => Time.now, - "type" => "search", - "body" => body, - } - execute(message, &block) - end - - # Sends a request message and receives one ore more response + # Sends a request message and receives one or more response # messages. # - # @overload execute(message, options={}) - # Executes the request message synchronously. + # @overload shuttle(message, options={}) + # Sends the request message and receives one or more + # messages synchronously. # # @param message [Hash] Request message. - # @param options [Hash] The options to executes a request. + # @param options [Hash] The options. # TODO: WRITE ME # # @return [Object] The response. TODO: WRITE ME # - # @overload execute(message, options={}, &block) - # Executes the passed request message asynchronously. + # @overload shuttle(message, options={}, &block) + # Sends the request message and receives one or more + # response messages asynchronously. # # @param message [Hash] Request message. - # @param options [Hash] The options to executes a request. + # @param options [Hash] The options. # TODO: WRITE ME # @yield [response] # The block is called when response is received. @@ -83,7 +75,7 @@ module Droonga # The response. # # @return [Request] The request object. - def execute(message, options={}, &block) + def shuttle(message, options={}, &block) receiver = Receiver.new message = message.dup message["replyTo"] = "#{receiver.host}:#{receiver.port}/droonga" -------------- next part -------------- HTML����������������������������... ダウンロード