Kouhei Sutou
null+****@clear*****
Fri Nov 22 17:08:41 JST 2013
Kouhei Sutou 2013-11-22 17:08:41 +0900 (Fri, 22 Nov 2013) New Revision: 14d02ce7aed22f0fe27d771d19ba7799548c6b74 https://github.com/droonga/fluent-plugin-droonga/commit/14d02ce7aed22f0fe27d771d19ba7799548c6b74 Message: Use PluginRepository Modified files: lib/droonga/executor.rb lib/droonga/handler_plugin.rb Modified: lib/droonga/executor.rb (+2 -2) =================================================================== --- lib/droonga/executor.rb 2013-11-22 17:03:11 +0900 (967a5c7) +++ lib/droonga/executor.rb 2013-11-22 17:08:41 +0900 (a7f8320) @@ -63,8 +63,8 @@ module Droonga end def add_handler(name) - plugin = HandlerPlugin.new(name) - @handlers << plugin.instantiate(self) + handler = HandlerPlugin.instantiate(name, self) + @handlers << handler end def add_route(route) Modified: lib/droonga/handler_plugin.rb (+8 -9) =================================================================== --- lib/droonga/handler_plugin.rb 2013-11-22 17:03:11 +0900 (729ac55) +++ lib/droonga/handler_plugin.rb 2013-11-22 17:08:41 +0900 (b322cdd) @@ -15,21 +15,20 @@ # 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/plugin_repository" + module Droonga class HandlerPlugin - @@plugins = {} + @@repository = PluginRepository.new + class << self def register(name, handler_class) - @@plugins[name] = handler_class + @@repository.register(name, handler_class) end - end - def initialize(name) - @name = name - end - - def instantiate(*args) - @@plugins[@name].new(*args) + def instantiate(name, *args, &block) + @@repository.instantiate(name, *args, &block) + end end end end -------------- next part -------------- HTML����������������������������...Download