module Mumukit::Templates::WithStructuredResults

Public Instance Methods

extract_result(result) click to toggle source
# File lib/mumukit/templates/with_structured_results.rb, line 17
def extract_result(result)
  separator = self.class.instance_variable_get :@separator
  result = result.split(separator).last if separator.present?
  result
end
post_process_file(file, result, status) click to toggle source
# File lib/mumukit/templates/with_structured_results.rb, line 2
def post_process_file(file, result, status)
  result = extract_result(result)
  if [:passed, :failed].include? status
    [to_structured_result(result)]
  else
    post_process_unstructured_result(file, result, status)
  end
rescue JSON::ParserError
  post_process_unstructured_result(file, result, :errored)
end
post_process_unstructured_result(_file, result, status) click to toggle source
# File lib/mumukit/templates/with_structured_results.rb, line 13
def post_process_unstructured_result(_file, result, status)
  [result, status]
end
to_structured_result(result) click to toggle source
# File lib/mumukit/templates/with_structured_results.rb, line 23
def to_structured_result(result)
  JSON.pretty_parse(result)
end