Skip to content

Commit c55826f

Browse files
committed
Merge pull request #12 from aadlww/patch-1
Error: undefined method `collect' for #<String:0x007ff92c24c2c8> (NoMethodError) in Ruby 1.9.3
2 parents 802dc44 + 1797819 commit c55826f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/xsd/codegen/gensupport.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,22 +236,22 @@ def format(str, indent = nil)
236236
private
237237

238238
def trim_eol(str)
239-
str.collect { |line|
239+
str.lines.collect { |line|
240240
line.sub(/\r?\n\z/, "") + "\n"
241241
}.join
242242
end
243243

244244
def trim_indent(str)
245245
indent = nil
246-
str = str.collect { |line| untab(line) }.join
247-
str.each do |line|
246+
str = str.lines.collect { |line| untab(line) }.join
247+
str.lines do |line|
248248
head = line.index(/\S/)
249249
if !head.nil? and (indent.nil? or head < indent)
250250
indent = head
251251
end
252252
end
253253
return str unless indent
254-
str.collect { |line|
254+
str.lines.collect { |line|
255255
line.sub(/^ {0,#{indent}}/, "")
256256
}.join
257257
end

0 commit comments

Comments
 (0)