ActionView::Helpers::TextHelper
def word_wrap(text, line_width: 80, break_sequence: "\n")

Description

Returns the string with line breaks inserted so that each line fits within a given length.

Arguments

Changing a value updates the ERB and HTML.

Breaks lines at spaces so that each line fits within the line_width argument. Words longer than line_width are not split. The returned string is not escaped; the escaping in the HTML section is done by <%= %>.
= 80
8
The maximum length of a line.
= nil
Inserts the given string instead of a newline. Newlines already in the text are replaced with it too.

ERB

Changes from the previous output: Added Removed Changed


          

HTML