method
indent_text
v2_4_6 -
Show latest stable
- Class:
REXML::Text
indent_text(string, level=1, style="\\t", indentfirstline=true)public
No documentation available.
# File lib/rexml/text.rb, line 280
def indent_text(string, level=1, style="\t", indentfirstline=true)
return string if level < 0
new_string = ''
string.each_line { |line|
indent_string = style * level
new_line = (indent_string + line).sub(/[\s]+$/,'')
new_string << new_line
}
new_string.strip! unless indentfirstline
return new_string
end