Class: Martlet::Grade
- Inherits:
-
Object
- Object
- Martlet::Grade
- Includes:
- Comparable
- Defined in:
- lib/martlet/grade.rb
Instance Attribute Summary collapse
-
#letter ⇒ Object
readonly
Returns the value of attribute letter.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(letter) ⇒ Grade
constructor
A new instance of Grade.
Constructor Details
#initialize(letter) ⇒ Grade
Returns a new instance of Grade.
7 8 9 |
# File 'lib/martlet/grade.rb', line 7 def initialize(letter) @letter = letter.upcase end |
Instance Attribute Details
#letter ⇒ Object (readonly)
Returns the value of attribute letter.
5 6 7 |
# File 'lib/martlet/grade.rb', line 5 def letter @letter end |
Instance Method Details
#<=>(other) ⇒ Object
11 12 13 |
# File 'lib/martlet/grade.rb', line 11 def <=>(other) letters.index(letter) <=> letters.index(other.letter) end |