diagnostic_rt_qpcr/libraries/preparertqpcrvalidation/source.rb
# Validates that all operations are as expected
#
# @param operations [OperationList] list of operations
# @raise rescue will Error any operations that do not pass validation
Validates that all operations are as expected
Validates that all operations are as expected
def validate(operations:)
    input_errors = []
    content_errors = []
    all_errors = []
    operations.each do |op|
      valid_input, input_error = validate_inputs(op)
      valid_contents, content_error = validate_contents(op)
      unless valid_input
        all_errors.push(op)
        input_errors.push({op: op, error: input_error})
        op.error(:IncompatibleInputsError, input_error)
      end
      unless valid_contents
        all_errors.push(op)
        content_errors.push({op: op, error: content_error})
        op.error(:InvalidContentsError, content_error)
      end
    end
    display_error(input_errors) unless input_errors.empty?
    display_error(content_errors) unless content_errors.empty?
    all_errors
  end
def validate ( operations : ) input_errors = [ ] content_errors = [ ] all_errors = [ ] operations . each do | op | valid_input , input_error = validate_inputs ( op ) valid_contents , content_error = validate_contents ( op ) unless valid_input all_errors . push ( op ) input_errors . push ( { op : op , error : input_error } ) op . error ( :IncompatibleInputsError , input_error ) end unless valid_contents all_errors . push ( op ) content_errors . push ( { op : op , error : content_error } ) op . error ( :InvalidContentsError , content_error ) end end display_error ( input_errors ) unless input_errors . empty? display_error ( content_errors ) unless content_errors . empty? all_errors end
Validates that all operations are as expected
Validates that all operations are as expected
rescue will Error any operations that do not pass validation
rescue will Error any operations that do not pass validation
operations
list of operations
list of operations