Class: Gaku::Grading::Collection::BaseMethod
- Inherits:
-
Object
- Object
- Gaku::Grading::Collection::BaseMethod
- Defined in:
- lib/gaku/grading/collection/base_method.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#criteria ⇒ Object
readonly
Returns the value of attribute criteria.
-
#gradable ⇒ Object
readonly
Returns the value of attribute gradable.
-
#gradable_scope ⇒ Object
readonly
Returns the value of attribute gradable_scope.
-
#gradable_type ⇒ Object
readonly
Returns the value of attribute gradable_type.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#students ⇒ Object
readonly
Returns the value of attribute students.
Instance Method Summary collapse
-
#grade ⇒ Object
Obtain graded hash of results.
-
#initialize(gradable, students, gradable_scope, criteria = nil) ⇒ BaseMethod
constructor
Pass a gradable object [exam or assignment] and students.
Constructor Details
#initialize(gradable, students, 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/collection/base_method.rb', line 8 def initialize(gradable, students, gradable_scope, criteria = nil) @gradable_scope = gradable_scope @gradable = gradable @students = students @criteria = criteria @result = [] end |
Instance Attribute Details
#criteria ⇒ Object (readonly)
Returns the value of attribute criteria.
5 6 7 |
# File 'lib/gaku/grading/collection/base_method.rb', line 5 def criteria @criteria end |
#gradable ⇒ Object (readonly)
Returns the value of attribute gradable.
5 6 7 |
# File 'lib/gaku/grading/collection/base_method.rb', line 5 def gradable @gradable end |
#gradable_scope ⇒ Object (readonly)
Returns the value of attribute gradable_scope.
5 6 7 |
# File 'lib/gaku/grading/collection/base_method.rb', line 5 def gradable_scope @gradable_scope end |
#gradable_type ⇒ Object (readonly)
Returns the value of attribute gradable_type.
5 6 7 |
# File 'lib/gaku/grading/collection/base_method.rb', line 5 def gradable_type @gradable_type end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
5 6 7 |
# File 'lib/gaku/grading/collection/base_method.rb', line 5 def results @results end |
#students ⇒ Object (readonly)
Returns the value of attribute students.
5 6 7 |
# File 'lib/gaku/grading/collection/base_method.rb', line 5 def students @students end |
Instance Method Details
#grade ⇒ Object
Obtain graded hash of results
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gaku/grading/collection/base_method.rb', line 17 def grade case @gradable when Gaku::Exam grade_exam when Gaku::Assignment grade_assignment(@gradable) end Gaku::Grading::Collection::Result.new(@gradable.id, @result).as_json end |