Skip to content

Commit

Permalink
Merge pull request #8 from long-long-float/add-catalog-plugin
Browse files Browse the repository at this point in the history
Add "catalog.fetch" command
  • Loading branch information
piroor committed Aug 20, 2014
2 parents 2c6bf04 + f5126b1 commit c84abd0
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions lib/droonga/plugins/catalog.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright (C) 2013-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

require "droonga/plugin"

module Droonga
module Plugins
module Catalog
extend Plugin
register("catalog")

class FetchHandler < Droonga::Handler
action.synchronous = false

def handle(message)
JSON.parse(Path.catalog.read)
end
end

define_single_step do |step|
step.name = "catalog.fetch"
step.handler = FetchHandler
step.collector = Collectors::Or
end
end
end
end

0 comments on commit c84abd0

Please sign in to comment.