Readlines by : readline « File Directory « Ruby






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('|') }


 








Related examples in the same category

1.readline raises an EOFError when it reaches the end of the file.