[Groonga-commit] droonga/fluent-plugin-droonga at aa13a3c [master] :in operator accepts Array of Array of String instead of Array of String

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Feb 7 11:23:34 JST 2014


Kouhei Sutou	2014-02-07 11:23:34 +0900 (Fri, 07 Feb 2014)

  New Revision: aa13a3c38a5b62ba8487b586c266caaa9ad11526
  https://github.com/droonga/fluent-plugin-droonga/commit/aa13a3c38a5b62ba8487b586c266caaa9ad11526

  Message:
    :in operator accepts Array of Array of String instead of Array of String

  Modified files:
    lib/droonga/command.rb
    lib/droonga/plugin/output_adapter/groonga.rb
    test/unit/test_command.rb

  Modified: lib/droonga/command.rb (+3 -1)
===================================================================
--- lib/droonga/command.rb    2014-02-07 11:07:24 +0900 (9933f78)
+++ lib/droonga/command.rb    2014-02-07 11:23:34 +0900 (f238daf)
@@ -92,7 +92,9 @@ module Droonga
       when :equal
         [target] == arguments
       when :in
-        arguments.include?(target)
+        arguments.any? do |argument|
+          argument.include?(target)
+        end
       when :include?
         return false unless target.respond_to?(:include?)
         arguments.any? do |argument|

  Modified: lib/droonga/plugin/output_adapter/groonga.rb (+1 -1)
===================================================================
--- lib/droonga/plugin/output_adapter/groonga.rb    2014-02-07 11:07:24 +0900 (6bd2349)
+++ lib/droonga/plugin/output_adapter/groonga.rb    2014-02-07 11:23:34 +0900 (c260bdd)
@@ -32,7 +32,7 @@ module Droonga
       "column_create.result",
     ]
     command :convert_generic_result,
-            :pattern => ["replyTo.type", :in, *groonga_results]
+            :pattern => ["replyTo.type", :in, groonga_results]
     def convert_generic_result(output_message)
       if output_message.body.include?("result")
         output_message.body = output_message.body["result"]

  Modified: test/unit/test_command.rb (+2 -2)
===================================================================
--- test/unit/test_command.rb    2014-02-07 11:07:24 +0900 (0ef703f)
+++ test/unit/test_command.rb    2014-02-07 11:23:34 +0900 (681ed85)
@@ -82,14 +82,14 @@ class CommandTest < Test::Unit::TestCase
 
     class InTest < self
       def test_exist
-        assert_true(match?(["type", :in, "table_create", "table_remove"],
+        assert_true(match?(["type", :in, ["table_create", "table_remove"]],
                            {
                              "type" => "table_remove"
                            }))
       end
 
       def test_not_exist
-        assert_false(match?(["type", :in, "table_create", "table_remove"],
+        assert_false(match?(["type", :in, ["table_create", "table_remove"]],
                             {
                               "type" => "column_create",
                             }))
-------------- next part --------------
HTML����������������������������...
Download 



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