Skip to content

Commit 33b360c

Browse files
committed
Use #each_line instead of #lines for Ruby 1.8.6
Possible fix for: https://github.com/nene/jsduck/issues/23
1 parent def3e65 commit 33b360c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/jsduck/source_file.rb

+6-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ def html_filename=(html_filename)
4747
# Returns source code as HTML with lines starting doc-comments specially marked.
4848
def to_html
4949
linenr = 0
50-
return @contents.lines.map do |line|
50+
lines = []
51+
# Use #each_line instead of #lines to support Ruby 1.6
52+
@contents.each_line do |line|
5153
linenr += 1;
5254
line = CGI.escapeHTML(line)
5355
# wrap the line in as many spans as there are links to this line number.
@@ -56,8 +58,9 @@ def to_html
5658
line = "<span id='#{id(doc)}'>#{line}</span>"
5759
end
5860
end
59-
line
60-
end.join()
61+
lines << line
62+
end
63+
lines.join()
6164
end
6265

6366
def id(doc)

0 commit comments

Comments
 (0)