I was given a file of size 46KB full of names (around ~5000), in the format as shown below:
"MARY","PATRICIA","LINDA","BARBARA","ELIZABETH"..."DARRELL","ALONSO"
I wonder if my code below is optimal in doing what I want, which is to translate this txt file into an array of names.
array = []
File.readlines('names.txt').each do |l|
array << l.delete("\"").split(",")
end
array.flatten