[Groonga-commit] groonga/groonga-command at f55d4d4 [fix-travis-ci-error] ruby_eval: add

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Jan 13 17:21:35 JST 2016


Kouhei Sutou	2013-10-14 23:03:13 +0900 (Mon, 14 Oct 2013)

  New Revision: f55d4d43e19e6dc66721dd297ae5d206646e069f
  https://github.com/groonga/groonga-command/commit/f55d4d43e19e6dc66721dd297ae5d206646e069f

  Message:
    ruby_eval: add

  Added files:
    lib/groonga/command/ruby-eval.rb
    test/command/test-ruby-eval.rb
  Modified files:
    lib/groonga/command.rb

  Modified: lib/groonga/command.rb (+1 -0)
===================================================================
--- lib/groonga/command.rb    2013-10-14 22:42:51 +0900 (7827569)
+++ lib/groonga/command.rb    2013-10-14 23:03:13 +0900 (fd3fee9)
@@ -30,6 +30,7 @@ require "groonga/command/get"
 require "groonga/command/load"
 require "groonga/command/normalize"
 require "groonga/command/register"
+require "groonga/command/ruby-eval"
 require "groonga/command/select"
 require "groonga/command/status"
 require "groonga/command/suggest"

  Added: lib/groonga/command/ruby-eval.rb (+44 -0) 100644
===================================================================
--- /dev/null
+++ lib/groonga/command/ruby-eval.rb    2013-10-14 23:03:13 +0900 (6abde15)
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2013  Kouhei Sutou <kou �� clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+require "groonga/command/base"
+
+module Groonga
+  module Command
+    # A command class that represents `ruby_eval` command.
+    #
+    # @since 1.0.6
+    class RubyEval < Base
+      Command.register("ruby_eval", self)
+
+      class << self
+        def parameter_names
+          [
+            :script,
+          ]
+        end
+      end
+
+      # @return [String] `script` parameter value.
+      # @since 1.0.6
+      def script
+        self[:script]
+      end
+    end
+  end
+end

  Added: test/command/test-ruby-eval.rb (+48 -0) 100644
===================================================================
--- /dev/null
+++ test/command/test-ruby-eval.rb    2013-10-14 23:03:13 +0900 (9d8dc55)
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2013  Kouhei Sutou <kou �� clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+class RubyEvalCommandTest < Test::Unit::TestCase
+  private
+  def ruby_eval_command(pair_arguments={}, ordered_arguments=[])
+    Groonga::Command::RubyEval.new("ruby_eval",
+                                   pair_arguments,
+                                   ordered_arguments)
+  end
+
+  class ConstructorTest < self
+    def test_ordered_arguments
+      script = "1 + 1"
+
+      ordered_arguments = [
+        script,
+      ]
+      command = ruby_eval_command({}, ordered_arguments)
+      assert_equal({
+                     :script => script,
+                   },
+                   command.arguments)
+    end
+  end
+
+  class ScriptTest < self
+    def test_reader
+      command = ruby_eval_command(:script => "1 + 1")
+      assert_equal("1 + 1", command.script)
+    end
+  end
+end
-------------- next part --------------
HTML����������������������������...
Download 



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