When reading inline templates, don't set encoding

for each line, but only once for the complete
file.
This commit is contained in:
Konstantin Haase 2010-12-13 13:56:53 +01:00
parent ff18f868a9
commit 8240bb7fbb
1 changed files with 2 additions and 1 deletions

View File

@ -930,13 +930,14 @@ module Sinatra
end end
lines = app.count("\n") + 1 lines = app.count("\n") + 1
template = nil template = nil
force_encoding data, encoding
data.each_line do |line| data.each_line do |line|
lines += 1 lines += 1
if line =~ /^@@\s*(.*\S)\s*$/ if line =~ /^@@\s*(.*\S)\s*$/
template = force_encoding('', encoding) template = force_encoding('', encoding)
templates[$1.to_sym] = [template, file, lines] templates[$1.to_sym] = [template, file, lines]
elsif template elsif template
template << force_encoding(line, encoding) template << line
end end
end end
end end