Recently coded something similar.
I just slurp the file into an array (File.readlines) and then
split the array into separate arrays of each record type.

cheers
Chris