We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 802dc44 + 1797819 commit c55826fCopy full SHA for c55826f
lib/xsd/codegen/gensupport.rb
@@ -236,22 +236,22 @@ def format(str, indent = nil)
236
private
237
238
def trim_eol(str)
239
- str.collect { |line|
+ str.lines.collect { |line|
240
line.sub(/\r?\n\z/, "") + "\n"
241
}.join
242
end
243
244
def trim_indent(str)
245
indent = nil
246
- str = str.collect { |line| untab(line) }.join
247
- str.each do |line|
+ str = str.lines.collect { |line| untab(line) }.join
+ str.lines do |line|
248
head = line.index(/\S/)
249
if !head.nil? and (indent.nil? or head < indent)
250
indent = head
251
252
253
return str unless indent
254
255
line.sub(/^ {0,#{indent}}/, "")
256
257
0 commit comments