and instead of read + split you can use http://apidock.com/ruby/IO/readlines