null+****@clear*****
null+****@clear*****
2012年 6月 5日 (火) 18:01:23 JST
Haruka Yoshihara 2012-06-05 18:01:23 +0900 (Tue, 05 Jun 2012)
New Revision: eb86fff59ab7488740e763558ace6abab4dbad4e
Log:
Translater: Rename: build_http_command => build_url
Because "http_command" is not commonly-used.
Modified files:
lib/groonga/tester.rb
test/test-executor.rb
Modified: lib/groonga/tester.rb (+5 -5)
===================================================================
--- lib/groonga/tester.rb 2012-06-05 17:37:46 +0900 (77a2cb0)
+++ lib/groonga/tester.rb 2012-06-05 18:01:23 +0900 (529bd1a)
@@ -627,7 +627,7 @@ module Groonga
translated_values = translate_arguments(now_command, arguments)
translated_command =
- build_http_command(now_command, translated_values)
+ build_url(now_command, translated_values)
if now_command == "load"
translated_command << "&values="
@@ -690,11 +690,11 @@ module Groonga
end
end
- def build_http_command(command, arguments)
- http_command = "/d/#{command}"
+ def build_url(command, arguments)
+ url = "/d/#{command}"
query = Rack::Utils.build_query(arguments)
- http_command << "?#{query}" unless query.empty?
- http_command
+ url << "?#{query}" unless query.empty?
+ url
end
end
Modified: test/test-executor.rb (+10 -10)
===================================================================
--- test/test-executor.rb 2012-06-05 17:37:46 +0900 (567bf1c)
+++ test/test-executor.rb 2012-06-05 18:01:23 +0900 (4c34c76)
@@ -66,7 +66,7 @@ class TestExecutor < Test::Unit::TestCase
"key_type" => "ShortText",
}
actual_command = translate(command)
- expected_command = build_http_command("table_create", arguments)
+ expected_command = build_url("table_create", arguments)
assert_equal(expected_command, actual_command)
end
@@ -74,7 +74,7 @@ class TestExecutor < Test::Unit::TestCase
def test_command_with_argument_name
command = "select --table Sites"
actual_command = translate(command)
- expected_command = build_http_command("select", "table" => "Sites")
+ expected_command = build_url("select", "table" => "Sites")
assert_equal(expected_command, actual_command)
end
@@ -82,7 +82,7 @@ class TestExecutor < Test::Unit::TestCase
def test_command_without_arguments
command = "dump"
actual_command = translate(command)
- expected_command = build_http_command(command, {})
+ expected_command = build_url(command, {})
assert_equal(expected_command, actual_command)
end
@@ -101,7 +101,7 @@ EOF
translate(line)
end
- expected_command = build_http_command("load", "table" => "Sites")
+ expected_command = build_url("load", "table" => "Sites")
expected_command << load_values_query(load_values)
assert_equal(expected_command, actual_commands.join("\n"))
@@ -119,7 +119,7 @@ EOF
translate(line)
end
- expected_command = build_http_command("load", "table" => "Sites")
+ expected_command = build_url("load", "table" => "Sites")
expected_command << load_values_query(load_values)
assert_equal(expected_command, actual_commands.join("\n"))
@@ -132,7 +132,7 @@ EOF
"output_columns" => "_key,uri",
}
actual_command = translate(command)
- expected_command = build_http_command("select", arguments)
+ expected_command = build_url("select", arguments)
assert_equal(expected_command, actual_command)
end
@@ -150,11 +150,11 @@ EOF
@translater.translate_command(command)
end
- def build_http_command(command, arguments)
- http_command = "/d/#{command}"
+ def build_url(command, arguments)
+ url = "/d/#{command}"
query = Rack::Utils.build_query(arguments)
- http_command << "?#{query}" unless query.empty?
- http_command
+ url << "?#{query}" unless query.empty?
+ url
end
def load_values_query(values)