Class: GradeCalculator

Inherits:
Object
  • Object
show all
Defined in:
lib/grade_calculator.rb

Class Method Summary collapse

Class Method Details

.calculate(file_name) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/grade_calculator.rb', line 5

def self.calculate(file_name)
    file = File.open(file_name)
    repository = GradeRepository.new(file.read)

    begin
        grades = repository.get_all_grades()
    rescue InvalidScoreExceptin => e
        puts e.message
        file.close()
    end

    file.close()
    grades
end