Kouhei Sutou
null+****@clear*****
Wed Jan 13 17:23:37 JST 2016
Kouhei Sutou 2015-08-09 00:08:29 +0900 (Sun, 09 Aug 2015) New Revision: c93dfe64c424a400ab919a1006cf3bceef4017d8 https://github.com/groonga/groonga-command/commit/c93dfe64c424a400ab919a1006cf3bceef4017d8 Message: Support thread_count Added files: lib/groonga/command/thread-count.rb test/command/test-thread-count.rb Modified files: lib/groonga/command.rb Modified: lib/groonga/command.rb (+1 -0) =================================================================== --- lib/groonga/command.rb 2015-08-06 20:59:41 +0900 (aacd2f3) +++ lib/groonga/command.rb 2015-08-09 00:08:29 +0900 (4c64e8d) @@ -53,5 +53,6 @@ require "groonga/command/table-list" require "groonga/command/table-remove" require "groonga/command/table-rename" require "groonga/command/table-tokenize" +require "groonga/command/thread-count" require "groonga/command/tokenize" require "groonga/command/truncate" Added: lib/groonga/command/thread-count.rb (+48 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/thread-count.rb 2015-08-09 00:08:29 +0900 (4b53385) @@ -0,0 +1,48 @@ +# 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 `thread_count` command. + # + # @since 1.1.3 + class ThreadCount < Base + Command.register("thread_count", self) + + class << self + def parameter_names + [ + :new_count, + ] + end + end + + # @return [Integer] `new_count` parameter value. + # + # @since 1.1.3 + def new_count + count = self[:new_count] + if count + Integer(count) + else + nil + end + end + end + end +end Added: test/command/test-thread-count.rb (+43 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-thread-count.rb 2015-08-09 00:08:29 +0900 (90ce9b8) @@ -0,0 +1,43 @@ +# 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 ThreadCountCommandTest < Test::Unit::TestCase + private + def thread_count_command(pair_arguments={}, ordered_arguments=[]) + Groonga::Command::ThreadCount.new("thread_count", + pair_arguments, + ordered_arguments) + end + + class ConstructorTest < self + def test_ordered_arguments + new_count = "1" + + command = thread_count_command({}, [new_count]) + assert_equal({ + :new_count => new_count, + }, + command.arguments) + end + end + + class NewCountTest < self + def test_reader + command = thread_count_command(:new_count => "1") + assert_equal(1, command.new_count) + end + end +end -------------- next part -------------- HTML����������������������������... Télécharger