method
trim_indent
v1_8_7_330 -
Show latest stable
- Class:
XSD::CodeGen::GenSupport
trim_indent(str)private
No documentation available.
# File lib/xsd/codegen/gensupport.rb, line 137
def trim_indent(str)
indent = nil
str = str.collect { |line| untab(line) }.join
str.each do |line|
head = line.index(/\S/)
if !head.nil? and (indent.nil? or head < indent)
indent = head
end
end
return str unless indent
str.collect { |line|
line.sub(/^ {0,#{indent}}/, "")
}.join
end