Method: YARD::Templates::Helpers::TextHelper#wrap

Defined in:
lib/yard/templates/helpers/text_helper.rb

#wrap(text, col = 72) ⇒ String

Returns wraps text at col columns.

Returns:

  • (String)

    wraps text at col columns.

[View source]

22
23
24
# File 'lib/yard/templates/helpers/text_helper.rb', line 22

def wrap(text, col = 72)
  text.gsub(/(.{1,#{col}})( +|$\n?)|(.{1,#{col}})/, "\\1\\3\n")
end