Class: Droonga::AdapterPlugin

Inherits:
Plugin
  • Object
show all
Extended by:
PluginRegisterable
Defined in:
lib/droonga/adapter_plugin.rb

Direct Known Subclasses

GroongaAdapter

Instance Method Summary collapse

Methods included from PluginRegisterable

command, extended, inherited, method_name, processable?, repository

Methods inherited from Plugin

#processable?, #shutdown, #start

Constructor Details

#initialize(dispatcher) ⇒ AdapterPlugin

Returns a new instance of AdapterPlugin.



24
25
26
27
# File 'lib/droonga/adapter_plugin.rb', line 24

def initialize(dispatcher)
  super()
  @dispatcher = dispatcher
end

Instance Method Details

#add_route(route) ⇒ Object



29
30
31
# File 'lib/droonga/adapter_plugin.rb', line 29

def add_route(route)
  @dispatcher.add_route(route)
end

#emit(value, name = nil) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/droonga/adapter_plugin.rb', line 37

def emit(value, name=nil)
  if name
    @output_values[name] = value
  else
    @output_values = value
  end
end

#post(body, destination = nil) ⇒ Object



33
34
35
# File 'lib/droonga/adapter_plugin.rb', line 33

def post(body, destination=nil)
  @dispatcher.post(body, destination)
end

#process(command, message) ⇒ Object



45
46
47
48
49
# File 'lib/droonga/adapter_plugin.rb', line 45

def process(command, message)
  @output_values = {}
  super(command, message)
  post(@output_values) unless @output_values.empty?
end