Kouhei Sutou
null+****@clear*****
Wed Jan 13 17:21:36 JST 2016
Kouhei Sutou 2013-10-14 23:06:30 +0900 (Mon, 14 Oct 2013) New Revision: c72ff89f9bb7ad8dac2e0d2cd23903b7a8ac1146 https://github.com/groonga/groonga-command/commit/c72ff89f9bb7ad8dac2e0d2cd23903b7a8ac1146 Message: ruby_load: add Added files: lib/groonga/command/ruby-load.rb test/command/test-ruby-load.rb Modified files: lib/groonga/command.rb Modified: lib/groonga/command.rb (+1 -0) =================================================================== --- lib/groonga/command.rb 2013-10-14 23:03:13 +0900 (fd3fee9) +++ lib/groonga/command.rb 2013-10-14 23:06:30 +0900 (09fc65a) @@ -31,6 +31,7 @@ require "groonga/command/load" require "groonga/command/normalize" require "groonga/command/register" require "groonga/command/ruby-eval" +require "groonga/command/ruby-load" require "groonga/command/select" require "groonga/command/status" require "groonga/command/suggest" Added: lib/groonga/command/ruby-load.rb (+44 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/ruby-load.rb 2013-10-14 23:06:30 +0900 (4815a8d) @@ -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_load` command. + # + # @since 1.0.6 + class RubyLoad < Base + Command.register("ruby_load", self) + + class << self + def parameter_names + [ + :path, + ] + end + end + + # @return [String] `path` parameter value. + # @since 1.0.6 + def path + self[:path] + end + end + end +end Added: test/command/test-ruby-load.rb (+48 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-ruby-load.rb 2013-10-14 23:06:30 +0900 (2f767b1) @@ -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 RubyLoadCommandTest < Test::Unit::TestCase + private + def ruby_load_command(pair_arguments={}, ordered_arguments=[]) + Groonga::Command::RubyLoad.new("ruby_load", + pair_arguments, + ordered_arguments) + end + + class ConstructorTest < self + def test_ordered_arguments + path = "my-library.rb" + + ordered_arguments = [ + path, + ] + command = ruby_load_command({}, ordered_arguments) + assert_equal({ + :path => path, + }, + command.arguments) + end + end + + class PathTest < self + def test_reader + command = ruby_load_command(:path => "my-library.rb") + assert_equal("my-library.rb", command.path) + end + end +end -------------- next part -------------- HTML����������������������������... Download