word_wrap
# HTML friendly version of text-wrapper. Forces the string to break
# at given length
def word_wrap(text, length=80)
text.split("\s").collect do |line|
line.length > length ? line.gsub(/(.{1,#{length}})(\s?|$)/, "\\1<br />").gsub(/<br \/>$/, '').strip : line
end * "\n"
end