Convert new lines to HTML breaks.

by Rabbit

This one’s nice and easy. The name was respectfully borrowed from PHP.

1
2
3
4
5
6
7
class String
 
  def nl2br
    gsub("\n", '<br />')
  end
 
end