Kouhei Sutou
null+****@clear*****
Fri Jan 31 18:06:40 JST 2014
Kouhei Sutou 2014-01-31 18:06:40 +0900 (Fri, 31 Jan 2014) New Revision: 0139e7d953ca86f906b1e6d1be277c1574c41026 https://github.com/droonga/fluent-plugin-droonga/commit/0139e7d953ca86f906b1e6d1be277c1574c41026 Message: command: fix operator name :include? -> :in :in is derived from "IN" in SQL. Modified files: lib/droonga/command.rb lib/droonga/plugin/output_adapter/groonga.rb test/unit/test_command.rb Modified: lib/droonga/command.rb (+2 -2) =================================================================== --- lib/droonga/command.rb 2014-01-31 18:03:26 +0900 (df92ece) +++ lib/droonga/command.rb 2014-01-31 18:06:40 +0900 (08a53ee) @@ -28,7 +28,7 @@ module Droonga # * PATTERN = [TARGET_PATH, OPERATOR, ARGUMENTS*] # * PATTERN = [PATTERN, LOGICAL_OPERATOR, PATTERN] # * TARGET_PATH = "COMPONENT(.COMPONENT)*" - # * OPERATOR = :equal, :include? + # * OPERATOR = :equal, :in # (More operators may be added in the future. # For example, :exist?, :start_with and so on.) # * ARGUMENTS = OBJECT_DEFINED_IN_JSON* @@ -97,7 +97,7 @@ module Droonga case operator when :equal [target] == arguments - when :include? + when :in arguments.include?(target) else raise ArgumentError, "Unknown operator" Modified: lib/droonga/plugin/output_adapter/groonga.rb (+1 -1) =================================================================== --- lib/droonga/plugin/output_adapter/groonga.rb 2014-01-31 18:03:26 +0900 (6538465) +++ lib/droonga/plugin/output_adapter/groonga.rb 2014-01-31 18:06:40 +0900 (5a7402f) @@ -31,7 +31,7 @@ module Droonga "column_create.result", ] command :convert_groonga_result, - :patterns => [["replyTo.type", :include?, *groonga_results]] + :patterns => [["replyTo.type", :in, *groonga_results]] def convert_groonga_result(output_message) if output_message.body.include?("result") output_message.body = output_message.body["result"] Modified: test/unit/test_command.rb (+5 -5) =================================================================== --- test/unit/test_command.rb 2014-01-31 18:03:26 +0900 (78cb97b) +++ test/unit/test_command.rb 2014-01-31 18:06:40 +0900 (86c2d17) @@ -80,16 +80,16 @@ class CommandTest < Test::Unit::TestCase end end - class IncludeTest < self - def test_include - assert_true(match?([["type", :include?, "table_create", "table_remove"]], + class InTest < self + def test_exist + assert_true(match?([["type", :in, "table_create", "table_remove"]], { "type" => "table_remove" })) end - def test_not_included - assert_false(match?([["type", :include?, "table_create", "table_remove"]], + def test_not_exist + assert_false(match?([["type", :in, "table_create", "table_remove"]], { "type" => "column_create", })) -------------- next part -------------- HTML����������������������������...Download