Class: Inch::Evaluation::Grade
- Inherits:
-
Object
- Object
- Inch::Evaluation::Grade
- Extended by:
- Utils::ReadWriteMethods
- Defined in:
- lib/inch/evaluation/grade.rb
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 ⇒ Object
- #to_sym ⇒ Object
- #update(&block) ⇒ Object
Methods included from Utils::ReadWriteMethods
Constructor Details
#initialize(symbol) ⇒ Grade
Returns a new instance of Grade.
8 9 10 |
# File 'lib/inch/evaluation/grade.rb', line 8 def initialize(symbol) @symbol = symbol end |
Class Attribute Details
.grade_map ⇒ Object (readonly)
Returns the value of attribute grade_map.
25 26 27 |
# File 'lib/inch/evaluation/grade.rb', line 25 def grade_map @grade_map end |
Class Method Details
.all ⇒ Object
27 28 29 30 |
# File 'lib/inch/evaluation/grade.rb', line 27 def all @grade_map ||= {} @grade_map.values end |
.grade(symbol, &block) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/inch/evaluation/grade.rb', line 32 def grade(symbol, &block) @grade_map ||= {} @grade_map[symbol] ||= Grade.new(symbol) @grade_map[symbol].update(&block) if block @grade_map[symbol] end |
Instance Method Details
#to_s ⇒ Object
20 21 22 |
# File 'lib/inch/evaluation/grade.rb', line 20 def to_s @symbol.to_s end |
#to_sym ⇒ Object
16 17 18 |
# File 'lib/inch/evaluation/grade.rb', line 16 def to_sym @symbol end |
#update(&block) ⇒ Object
12 13 14 |
# File 'lib/inch/evaluation/grade.rb', line 12 def update(&block) instance_eval(&block) end |