Class: Aladdin::Submission

Inherits:
Object
  • Object
show all
Includes:
Aladdin::Support::WeakComparator
Defined in:
lib/aladdin/submission.rb

Overview

Student submission.

DANGER DANGER DANGER ==

The scratchspace code assumes that there is only one submission at a time, it’s unsuitable for production use. It does not impose any security restrictions at all.

Defined Under Namespace

Modules: Type

Constant Summary collapse

SCRATCHSPACE =
'.__ss'

Instance Method Summary collapse

Methods included from Aladdin::Support::WeakComparator

#same?

Constructor Details

#initialize(id, type, params, input, logger) ⇒ Submission

Creates a new student submission.

Parameters:

  • id (String)

    exercise ID

  • type (Type)

    problem or code

  • params (Hash)

    form values

  • input (String)

    student input



22
23
24
# File 'lib/aladdin/submission.rb', line 22

def initialize(id, type, params, input, logger)
  @id, @type, @params, @input, @logger = id, type, params, input, logger
end

Instance Method Details

#verifyObject

Verifies the student’s submission.



27
28
29
30
31
32
# File 'lib/aladdin/submission.rb', line 27

def verify
  case @type
  when Type::CODE then verify_code
  when Type::PROBLEM then verify_problem
  end
end