Class: WorkflowTemplate::Validation::Evaluation::Boolean

Inherits:
Abstract
  • Object
show all
Defined in:
lib/workflow_template/validation/evaluation/boolean.rb

Instance Attribute Summary

Attributes inherited from Abstract

#context, #key, #name, #validator

Instance Method Summary collapse

Methods inherited from Abstract

#call, #describe, #initialize

Constructor Details

This class inherits a constructor from WorkflowTemplate::Validation::Evaluation::Abstract

Instance Method Details

#evaluate(result) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/workflow_template/validation/evaluation/boolean.rb', line 9

def evaluate(result)
  result, detail = result
  if result
    case detail
    when nil then Result::Success
    when Hash, Array
      raise Fatal::BadValidationReturn, name unless detail.empty?

      Result::Success
    else
      raise Fatal::BadValidationReturn, name
    end
  else
    to_failure(detail)
  end
end