Skip to content

Commit

Permalink
Add comment explaining logic
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems committed Nov 14, 2017
1 parent 3e75ea2 commit b7f530b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/sprockets/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ def concat_javascript_sources(buf, source)
source = source.encode(Encoding::UTF_32LE) unless source.ascii_only?
return buf if string_end_with_semicolon?(source)

# If the last character in the string was whitespace,
# such as a newline, then we want to put the semicolon
# before the whitespace. Otherwise append a semicolon.
if whitespace = WHITESPACE_ORDINALS[source[-1].ord]
buf[-1] = ";#{whitespace}"
else
Expand Down

0 comments on commit b7f530b

Please sign in to comment.