Class: Martlet::Grade

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/martlet/grade.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#letterObject (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