[Groonga-commit] groonga/grntest [master] Translater: Update build_http_command to create a command from hash object

Back to archive index

null+****@clear***** null+****@clear*****
2012年 6月 5日 (火) 15:41:27 JST


Haruka Yoshihara	2012-06-05 15:41:27 +0900 (Tue, 05 Jun 2012)

  New Revision: 45c8b8d29ed5a1244602cd564024797376df5f59

  Log:
    Translater: Update build_http_command to create a command from hash object

  Modified files:
    lib/groonga/tester.rb

  Modified: lib/groonga/tester.rb (+10 -4)
===================================================================
--- lib/groonga/tester.rb    2012-06-05 15:30:33 +0900 (f67ce72)
+++ lib/groonga/tester.rb    2012-06-05 15:41:27 +0900 (bc1f41a)
@@ -635,7 +635,8 @@ module Groonga
           if loading
             load_values << command
             if command == "]"
-              translated_values << "values=#{load_values}"
+              translated_values =
+                translated_values.merge("values" => load_values)
               loading = false
               load_values = ""
             end
@@ -663,7 +664,7 @@ module Groonga
       private
       def translate_arguments(now_command, arguments)
         return [] if arguments.empty?
-        translated_values = []
+        translated_values = {}
         last_argument = ""
 
         arguments_count = 0
@@ -683,7 +684,8 @@ module Groonga
           end
 
           value = argument.gsub(/'/, "")
-          translated_values << "#{query_parameter}=#{value}"
+          translated_values =
+            translated_values.merge(query_parameter => value)
           arguments_count += 1
           last_command = ""
         end
@@ -716,7 +718,11 @@ module Groonga
       def build_http_command(now_command, arguments)
         translated_command = "/d/#{now_command}"
         unless arguments.empty?
-          translated_command << "?#{arguments.join("&")}"
+          translated_command << "?"
+          query = arguments.collect do |parameter, value|
+            "#{parameter}=#{value}"
+          end
+          translated_command << query.join("&")
         end
         translated_command
       end




Groonga-commit メーリングリストの案内
Back to archive index