module Substation::Processor::Evaluator::Handler

Helps returning an api compatible result from custom Evaluator handlers

Public Instance Methods

error(output) click to toggle source

Return an errorneous result

@param [Object] output

the data associated with the result

@return [Result::Failure]

@api private

# File lib/substation/processor/evaluator/handler.rb, line 30
def error(output)
  respond_with(Result::Failure, output)
end
success(output) click to toggle source

Return a successful result

@param [Object] output

the data associated with the result

@return [Result::Success]

@api private

# File lib/substation/processor/evaluator/handler.rb, line 18
def success(output)
  respond_with(Result::Success, output)
end

Private Instance Methods

respond_with(klass, output) click to toggle source

Return a new result subclass instance

@param [Result::Success, Result::Failure] klass

the result class

@param [Object] output

the data associated with the result

@return [Response]

@api private

# File lib/substation/processor/evaluator/handler.rb, line 47
def respond_with(klass, output)
  klass.new(output)
end