Small inline_template refactoring (use binread).

This commit is contained in:
Konstantin Haase 2010-12-13 15:13:58 +01:00
parent 8240bb7fbb
commit e6fd541db3
1 changed files with 1 additions and 3 deletions

View File

@ -914,9 +914,7 @@ module Sinatra
file = (file.nil? || file == true) ? (caller_files.first || File.expand_path($0)) : file
begin
io = '1.9'.respond_to?(:encoding) ?
::IO.read(file, nil, 0, :encoding => 'BINARY') :
::IO.read(file)
io = ::IO.respond_to?(:binread) ? ::IO.binread(file) : ::IO.read(file)
app, data = io.gsub("\r\n", "\n").split(/^__END__$/, 2)
rescue Errno::ENOENT
app, data = nil