class ReeText::WordWrap
def call(text, **opts)
def call(text, **opts) options = DEFAULTS.merge(opts) formated_text = text.dup formated_text.split("\n").collect do |line| if line.length > options[:line_width] line .gsub(/(.{1,#{options[:line_width]}})(\s+|$)/, "\\1#{options[:break_sequence]}") .rstrip else line end end * options[:break_sequence] end