Class: Inch::Evaluation::Grade
- Inherits:
-
Object
- Object
- Inch::Evaluation::Grade
- Extended by:
- Utils::ReadWriteMethods
- Defined in:
- lib/inch/evaluation/grade.rb
Overview
Grades are human-friendly representations of scores.
Class Attribute Summary collapse
-
.grade_map ⇒ Object
readonly
Returns the value of attribute grade_map.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(symbol) ⇒ Grade
constructor
A new instance of Grade.
-
#to_s ⇒ String
The grade as a string (e.g. “A”).
-
#to_sym ⇒ Symbol
The grade as a symbol (e.g.
:A
). -
#update(&block) ⇒ void
Updates the grade’s configuration with the given block.
Methods included from Utils::ReadWriteMethods
Constructor Details
#initialize(symbol) ⇒ Grade
Returns a new instance of Grade.
10 11 12 |
# File 'lib/inch/evaluation/grade.rb', line 10 def initialize(symbol) @symbol = symbol end |
Class Attribute Details
.grade_map ⇒ Object (readonly)
Returns the value of attribute grade_map.
33 34 35 |
# File 'lib/inch/evaluation/grade.rb', line 33 def grade_map @grade_map end |
Class Method Details
.all ⇒ Object
35 36 37 38 |
# File 'lib/inch/evaluation/grade.rb', line 35 def all @grade_map ||= {} @grade_map.values end |
Instance Method Details
#to_s ⇒ String
Returns the grade as a string (e.g. “A”).
28 29 30 |
# File 'lib/inch/evaluation/grade.rb', line 28 def to_s @symbol.to_s end |
#to_sym ⇒ Symbol
Returns the grade as a symbol (e.g. :A
).
23 24 25 |
# File 'lib/inch/evaluation/grade.rb', line 23 def to_sym @symbol end |
#update(&block) ⇒ void
This method returns an undefined value.
Updates the grade’s configuration with the given block
18 19 20 |
# File 'lib/inch/evaluation/grade.rb', line 18 def update(&block) instance_eval(&block) end |