Kouhei Sutou
null+****@clear*****
Thu Jan 30 17:24:13 JST 2014
Kouhei Sutou 2014-01-30 17:24:13 +0900 (Thu, 30 Jan 2014) New Revision: 89223c8e21fd28f4d65da6da4f20f4a459cfef95 https://github.com/droonga/fluent-plugin-droonga/commit/89223c8e21fd28f4d65da6da4f20f4a459cfef95 Message: Add InputAdapterOptions Added files: lib/droonga/input_adapter_options.rb test/unit/input_adapter/test_options.rb Added: lib/droonga/input_adapter_options.rb (+26 -0) 100644 =================================================================== --- /dev/null +++ lib/droonga/input_adapter_options.rb 2014-01-30 17:24:13 +0900 (04ca8bd) @@ -0,0 +1,26 @@ +# Copyright (C) 2014 Droonga Project +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1 as published by the Free Software Foundation. +# +# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +module Droonga + class InputAdapterOptions + def initialize(data) + @data = data || {} + end + + def plugins + @data["plugins"] || [] + end + end +end Added: test/unit/input_adapter/test_options.rb (+36 -0) 100644 =================================================================== --- /dev/null +++ test/unit/input_adapter/test_options.rb 2014-01-30 17:24:13 +0900 (0fa0342) @@ -0,0 +1,36 @@ +# Copyright (C) 2014 Droonga Project +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1 as published by the Free Software Foundation. +# +# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +require "droonga/input_adapter_options" + +class InputAdapterOptionsTest < Test::Unit::TestCase + def options(data) + Droonga::InputAdapterOptions.new(data) + end + + class PluginsTest < self + def plugins(data) + options(data).plugins + end + + def test_nothing + assert_equal([], plugins({})) + end + + def test_have_values + assert_equal(["groonga"], plugins("plugins" => ["groonga"])) + end + end +end -------------- next part -------------- HTML����������������������������...Download