Readlines by
open('pipe_separated_records', 'w') do |f| f << "This is record one.|This is record two.|This is record three." end open('pipe_separated_records') { |f| f.readlines('|') }