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