You can read an I/O stream with each using a custom delimiter of your choosing:
File.open("main.rb").each(',') { |line| puts line }
Here, you passed an optional argument to each that specified a Comma from the default "newline" delimiter.
You can override the default delimiter by setting the special variable $/ to any delimiter you choose.