class Coursemology::Evaluator::Models::ProgrammingEvaluation

Public Instance Methods

evaluate() click to toggle source

Evaluates the package, and stores the result in this record.

Call {Coursemology::Evaluator::Models::ProgrammingEvaluation#save} to save the record to the server.

# File lib/coursemology/evaluator/models/programming_evaluation.rb, line 47
def evaluate
  result = Coursemology::Evaluator::Services::EvaluateProgrammingPackageService.
           execute(self)
  self.stdout = result.stdout
  self.stderr = result.stderr
  self.test_report = result.test_report
  self.exit_code = result.exit_code
end
language() click to toggle source

Gets the language for the programming evaluation.

@return [nil] If the language does not exist. @return [Coursemology::Polyglot::Language] The language that the evaluation uses.

Calls superclass method
# File lib/coursemology/evaluator/models/programming_evaluation.rb, line 17
def language
  Coursemology::Polyglot::Language.find_by(type: super)
end
language=(language) click to toggle source

Sets the language for the programming evaluation.

@param [String|nil|Coursemology::Polyglot::Language] language The language to set. If this is

a string, it is assumed to be the class name of the language.
Calls superclass method
# File lib/coursemology/evaluator/models/programming_evaluation.rb, line 25
def language=(language)
  return super(language) if language.nil? || language.is_a?(String)

  fail ArgumentError unless language.is_a?(Coursemology::Polyglot::Language)
  super(language.class.name)
end
package() click to toggle source

Obtains the package.

@return [Coursemology::Evaluator::Models::ProgrammingEvaluation::Package]

# File lib/coursemology/evaluator/models/programming_evaluation.rb, line 35
def package
  @package ||= begin
    body = self.class._plain_request('courses/assessment/programming_evaluations/:id/package',
                                     :get, id: id)
    Package.new(Coursemology::Evaluator::StringIO.new(body))
  end
end