lib/xsd/codegen/gensupport.rb in soap4r-straightjacket-1.5.8 vs lib/xsd/codegen/gensupport.rb in soap4r-straightjacket-1.5.9
- old
+ new
@@ -234,27 +234,27 @@
end
private
def trim_eol(str)
- str.collect { |line|
+ str.each_line { |line|
line.sub(/\r?\n\z/, "") + "\n"
- }.join
+ }
end
def trim_indent(str)
indent = nil
- str = str.collect { |line| untab(line) }.join
- str.each do |line|
+ str = str.each_line { |line| untab(line) }
+ str.each_line 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|
+ str.each_line { |line|
line.sub(/^ {0,#{indent}}/, "")
- }.join
+ }
end
def untab(line, ts = 8)
while pos = line.index(/\t/)
line = line.sub(/\t/, " " * (ts - (pos % ts)))