Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
14 lines (14 sloc) 424 Bytes
module REXML
module Formatters
class Pretty < Default
private
def wrap(string, width)
# Recursivly wrap string at width.
return string if string.length <= width
place = string.rindex(/\s+/, 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
end
end
end
Jump to Line
Something went wrong with that request. Please try again.