Class: StudentGradeManager::Grade
- Inherits:
-
Object
- Object
- StudentGradeManager::Grade
- Defined in:
- lib/student_grade_manager/grade.rb,
sig/student_grade_manager.rbs
Overview
Represents a grade with a subject, score, and coefficient.
Instance Attribute Summary collapse
-
#coefficient ⇒ Numeric
readonly
Returns the value of attribute coefficient.
-
#score ⇒ Numeric
readonly
Returns the value of attribute score.
-
#subject ⇒ String
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
-
#initialize(subject:, score:, coefficient:) ⇒ Grade
constructor
A new instance of Grade.
Constructor Details
#initialize(subject:, score:, coefficient:) ⇒ Grade
Returns a new instance of Grade.
8 9 10 11 12 13 14 15 16 |
# File 'lib/student_grade_manager/grade.rb', line 8 def initialize(subject:, score:, coefficient:) validate_subject(subject) validate_score(score) validate_coefficient(coefficient) @subject = subject.strip @score = score @coefficient = coefficient end |
Instance Attribute Details
#coefficient ⇒ Numeric (readonly)
Returns the value of attribute coefficient.
6 7 8 |
# File 'lib/student_grade_manager/grade.rb', line 6 def coefficient @coefficient end |
#score ⇒ Numeric (readonly)
Returns the value of attribute score.
6 7 8 |
# File 'lib/student_grade_manager/grade.rb', line 6 def score @score end |
#subject ⇒ String (readonly)
Returns the value of attribute subject.
6 7 8 |
# File 'lib/student_grade_manager/grade.rb', line 6 def subject @subject end |