Kouhei Sutou
null+****@clear*****
Thu Jan 30 17:48:06 JST 2014
Kouhei Sutou 2014-01-30 17:48:06 +0900 (Thu, 30 Jan 2014) New Revision: 425109e9c1848bff21d828c84b270ba90ed1fdeb https://github.com/droonga/fluent-plugin-droonga/commit/425109e9c1848bff21d828c84b270ba90ed1fdeb Message: Add OutputAdapterOptions Added files: lib/droonga/output_adapter_options.rb test/unit/output_adapter/test_options.rb Added: lib/droonga/output_adapter_options.rb (+26 -0) 100644 =================================================================== --- /dev/null +++ lib/droonga/output_adapter_options.rb 2014-01-30 17:48:06 +0900 (2b4b560) @@ -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 OutputAdapterOptions + def initialize(data) + @data = data || {} + end + + def plugins + @data["plugins"] || [] + end + end +end Added: test/unit/output_adapter/test_options.rb (+36 -0) 100644 =================================================================== --- /dev/null +++ test/unit/output_adapter/test_options.rb 2014-01-30 17:48:06 +0900 (a0816e5) @@ -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/output_adapter_options" + +class OutputAdapterOptionsTest < Test::Unit::TestCase + def options(data) + Droonga::OutputAdapterOptions.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