module Wrap
Public Instance Methods
wrap(str, width = 80)
click to toggle source
# File lib/dpl/helper/wrap.rb, line 6 def wrap(str, width = 80) str.lines.map do |line| line.size > width ? line.gsub(/(.{1,#{width}})(\s+|$)/, "\\1\n").strip : line end.join("\n") end