I am retrieving emails using the Fetcher plugin for Rails. It is doing a fine job. But I am trying to split the body of the email on newlines but it appears that it is only one really long line.
What is the best way (in Ruby) to split an email up into multiple lines?
Sounds like you need a word wrapping algorithm. Here is a short and clever way of word wrapping in Ruby that I found on the ruby-talk mailing list (link is to Google’s cache because the site seems to be down):
Here’s a slightly prettier version wrapped in a method: