Kouhei Sutou
null+****@clear*****
Wed Feb 3 18:39:49 JST 2016
Kouhei Sutou 2016-02-03 18:39:49 +0900 (Wed, 03 Feb 2016) New Revision: 02682de636c122e12afc2ae2c9180f14a96791aa https://github.com/groonga/groonga-command/commit/02682de636c122e12afc2ae2c9180f14a96791aa Message: Support inspect command Added files: lib/groonga/command/inspect.rb test/command/test-inspect.rb Modified files: lib/groonga/command.rb Modified: lib/groonga/command.rb (+1 -0) =================================================================== --- lib/groonga/command.rb 2016-01-19 23:55:58 +0900 (6e8038f) +++ lib/groonga/command.rb 2016-02-03 18:39:49 +0900 (5195421) @@ -31,6 +31,7 @@ require "groonga/command/config-set" require "groonga/command/delete" require "groonga/command/dump" require "groonga/command/get" +require "groonga/command/inspect" require "groonga/command/io-flush" require "groonga/command/load" require "groonga/command/logical-count" Added: lib/groonga/command/inspect.rb (+43 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/inspect.rb 2016-02-03 18:39:49 +0900 (1196567) @@ -0,0 +1,43 @@ +# Copyright (C) 2016 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 `inspect` command. + # + # @since 1.1.6 + class Inspect < Base + Command.register("inspect", self) + + class << self + def parameter_names + [ + :target_name, + ] + end + end + + # @return [String] `target_name` parameter value. + # + # @since 1.1.6 + def target_name + self[:target_name] + end + end + end +end Added: test/command/test-inspect.rb (+46 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-inspect.rb 2016-02-03 18:39:49 +0900 (ae23901) @@ -0,0 +1,46 @@ +# Copyright (C) 2016 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 InspectCommandTest < Test::Unit::TestCase + private + def inspect_command(pair_arguments={}, ordered_arguments=[]) + Groonga::Command::Inspect.new("inspect", + pair_arguments, + ordered_arguments) + end + + class ConstructorTest < self + def test_ordered_arguments + target_name = "Users" + + command = inspect_command({}, + [ + target_name, + ]) + assert_equal({ + :target_name => target_name, + }, + command.arguments) + end + end + + class TargetNameTest < self + def test_reader + command = inspect_command(:target_name => "Users") + assert_equal("Users", command.target_name) + end + end +end -------------- next part -------------- HTML����������������������������... 下載