method
wrap
v1_9_2_180 -
Show latest stable
- Class:
REXML::Formatters::Pretty
wrap(string, width)private
No documentation available.
# File lib/rexml/formatters/pretty.rb, line 128
def wrap(string, width)
# Recursively wrap string at width.
return string if string.length <= width
place = string.rindex(' ', width) # Position in string with last ' ' before cutoff
return string if place.nil?
return string[0,place] + "\n" + wrap(string[place+1..-1], width)
end