Class: Droonga::Plugins::Groonga::GenericCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/droonga/plugins/groonga/generic_command.rb

Defined Under Namespace

Classes: CommandError

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ GenericCommand

Returns a new instance of GenericCommand.



38
39
40
# File 'lib/droonga/plugins/groonga/generic_command.rb', line 38

def initialize(context)
  @context = context
end

Instance Method Details

#execute(request) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/droonga/plugins/groonga/generic_command.rb', line 42

def execute(request)
  @start_time = Time.now.to_f
  result = process_request(request)
  [header(Status::SUCCESS), result]
rescue CommandError => error
  unless error.result.nil?
    [header(error.status, error.message), error.result]
  else
    [header(error.status, error.message)]
  end
end