8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/common_tools/parser.rb', line 8
def self.parse_roster(roster)
attributes_array = build_attributes(roster)
student_strings = roster.split(/\n/).reject(&:empty?).drop(1)
array_of_student_hashes = []
array_of_students = student_strings.collect { |student_string| student_string.split(',') }
array_of_students.each_with_object(attributes_array) do |student_array, attribute_hash|
array_of_student_hashes << [attribute_hash, student_array].transpose.to_h
end
array_of_student_hashes
end
|