Class: Gaku::Grading::Single::BaseMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/gaku/grading/single/base_method.rb

Direct Known Subclasses

Interval, Ordinal, PassFail, Percentage, Ratio, Score

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gradable, student, gradable_scope, criteria = nil) ⇒ BaseMethod

Pass a gradable object [exam or assignment] and students



8
9
10
11
12
13
14
# File 'lib/gaku/grading/single/base_method.rb', line 8

def initialize(gradable, student, gradable_scope, criteria = nil)
  @gradable = gradable
  @student = student
  @criteria = criteria
  @gradable_scope = gradable_scope
  @result = {}
end

Instance Attribute Details

#criteriaObject (readonly)

Returns the value of attribute criteria.



5
6
7
# File 'lib/gaku/grading/single/base_method.rb', line 5

def criteria
  @criteria
end

#gradableObject (readonly)

Returns the value of attribute gradable.



5
6
7
# File 'lib/gaku/grading/single/base_method.rb', line 5

def gradable
  @gradable
end

#gradable_scopeObject (readonly)

Returns the value of attribute gradable_scope.



5
6
7
# File 'lib/gaku/grading/single/base_method.rb', line 5

def gradable_scope
  @gradable_scope
end

#gradable_typeObject (readonly)

Returns the value of attribute gradable_type.



5
6
7
# File 'lib/gaku/grading/single/base_method.rb', line 5

def gradable_type
  @gradable_type
end

#resultObject (readonly)

Returns the value of attribute result.



5
6
7
# File 'lib/gaku/grading/single/base_method.rb', line 5

def result
  @result
end

#studentObject (readonly)

Returns the value of attribute student.



5
6
7
# File 'lib/gaku/grading/single/base_method.rb', line 5

def student
  @student
end

Instance Method Details

#gradeObject

Obtain graded hash of results



17
18
19
20
21
22
23
24
25
26
# File 'lib/gaku/grading/single/base_method.rb', line 17

def grade
  case @gradable
  when Gaku::Exam
    grade_exam
  when Gaku::Assignment
    #grade_assignment
  end

  Gaku::Grading::Single::Result.new(@gradable.id, @result).as_json
end