Kosuke Asami
null+****@clear*****
Tue Jul 9 16:17:22 JST 2013
Kosuke Asami 2013-07-09 16:17:22 +0900 (Tue, 09 Jul 2013) New Revision: d0be1188dc8829e39dc4186039e43ad76f51bdb3 https://github.com/groonga/fluent-plugin-droonga/commit/d0be1188dc8829e39dc4186039e43ad76f51bdb3 Message: Extract handler plugin undertakes groonga-like API as a class Copied files: lib/droonga/plugin/groonga/table_create.rb (from lib/droonga/plugin/handler_groonga.rb) Modified files: lib/droonga/plugin/handler_groonga.rb Copied: lib/droonga/plugin/groonga/table_create.rb (+11 -11) 69% =================================================================== --- lib/droonga/plugin/handler_groonga.rb 2013-07-09 15:37:34 +0900 (0ec44c1) +++ lib/droonga/plugin/groonga/table_create.rb 2013-07-09 16:17:22 +0900 (4fda4a0) @@ -17,20 +17,20 @@ require "groonga" -require "droonga/handler" - module Droonga - class GroongaHandler < Droonga::Handler - Droonga::HandlerPlugin.register("groonga", self) + class GroongaHandler + class TableCreate + def initialize(context) + @context = context + end - command :table_create - def table_create(request) - name = request["name"] - Groonga::Schema.define(:context => @context) do |schema| - schema.create_table(name) + def execute(request) + name = request["name"] + Groonga::Schema.define(:context => @context) do |schema| + schema.create_table(name) + end + [true] end - outputs = [true] - post(outputs) end end end Modified: lib/droonga/plugin/handler_groonga.rb (+4 -5) =================================================================== --- lib/droonga/plugin/handler_groonga.rb 2013-07-09 15:37:34 +0900 (0ec44c1) +++ lib/droonga/plugin/handler_groonga.rb 2013-07-09 16:17:22 +0900 (0fb4294) @@ -25,12 +25,11 @@ module Droonga command :table_create def table_create(request) - name = request["name"] - Groonga::Schema.define(:context => @context) do |schema| - schema.create_table(name) - end - outputs = [true] + command = TableCreate.new(@context) + outputs = command.execute(request) post(outputs) end end end + +require "droonga/plugin/groonga/table_create" -------------- next part -------------- HTML����������������������������... ダウンロード