Class: Gpa::Grade
- Inherits:
-
String
- Object
- String
- Gpa::Grade
- Defined in:
- lib/gpa/course.rb
Constant Summary collapse
- UNIVERSITY_OF_ALBERTA_GRADE_TO_POINTS =
Returns University of Alberta grade to grade points hash.
{ 'A+' => 4.0, 'A' => 4.0, 'A-' => 3.7, 'B+' => 3.3, 'B' => 3.0, 'B-' => 2.7, 'C+' => 2.3, 'C' => 2.0, 'C-' => 1.7, 'D+' => 1.3, 'D' => 1.0, 'F' => 0.0 }
Instance Method Summary collapse
Instance Method Details
#has_points? ⇒ Boolean
28 29 30 |
# File 'lib/gpa/course.rb', line 28 def has_points? !UNIVERSITY_OF_ALBERTA_GRADE_TO_POINTS[self].nil? end |
#points ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/gpa/course.rb', line 20 def points points_ = UNIVERSITY_OF_ALBERTA_GRADE_TO_POINTS[self] unless points_ raise StandarError.new("Grade of \"#{self}\" has no point value!") end points_ end |