Kouhei Sutou
null+****@clear*****
Wed Jan 13 17:22:25 JST 2016
Kouhei Sutou 2015-01-26 14:10:32 +0900 (Mon, 26 Jan 2015) New Revision: 6aa3edd2faa0ab3fa4f707d8ec088bdb73d1a4f0 https://github.com/groonga/groonga-command/commit/6aa3edd2faa0ab3fa4f707d8ec088bdb73d1a4f0 Message: Support request_cancel Added files: lib/groonga/command/request-cancel.rb test/command/test-request-cancel.rb Modified files: lib/groonga/command.rb Modified: lib/groonga/command.rb (+1 -0) =================================================================== --- lib/groonga/command.rb 2014-10-02 20:57:11 +0900 (09fc65a) +++ lib/groonga/command.rb 2015-01-26 14:10:32 +0900 (da15db6) @@ -30,6 +30,7 @@ require "groonga/command/get" require "groonga/command/load" require "groonga/command/normalize" require "groonga/command/register" +require "groonga/command/request-cancel" require "groonga/command/ruby-eval" require "groonga/command/ruby-load" require "groonga/command/select" Added: lib/groonga/command/request-cancel.rb (+42 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/request-cancel.rb 2015-01-26 14:10:32 +0900 (101ab31) @@ -0,0 +1,42 @@ +# Copyright (C) 2015 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 `request_cancel` command. + # + # @since 1.1.0 + class RequestCancel < Base + Command.register("request_cancel", self) + + class << self + def parameter_names + [ + :id, + ] + end + end + + # @return [String] `id` parameter value. + # @since 1.1.0 + def id + self[:id] + end + end + end +end Added: test/command/test-request-cancel.rb (+46 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-request-cancel.rb 2015-01-26 14:10:32 +0900 (1c8998c) @@ -0,0 +1,46 @@ +# Copyright (C) 2015 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 RequestCancelCommandTest < Test::Unit::TestCase + private + def request_cancel_command(pair_arguments={}, ordered_arguments=[]) + Groonga::Command::RequestCancel.new("request_cancel", + pair_arguments, + ordered_arguments) + end + + class ConstructorTest < self + def test_ordered_arguments + id = "ID" + + ordered_arguments = [ + id, + ] + command = request_cancel_command({}, ordered_arguments) + assert_equal({ + :id => id, + }, + command.arguments) + end + end + + class IDTest < self + def test_reader + command = request_cancel_command(:id => "ID") + assert_equal("ID", command.id) + end + end +end -------------- next part -------------- HTML����������������������������...Download