Permalink
Browse files

Small inline_template refactoring (use binread).

  • Loading branch information...
1 parent 8240bb7 commit e6fd541db3031540d7e4c210330018bfee704637 @rkh rkh committed Dec 13, 2010
Showing with 1 addition and 3 deletions.
  1. +1 −3 lib/sinatra/base.rb
View
@@ -914,9 +914,7 @@ def inline_templates=(file=nil)
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

0 comments on commit e6fd541

Please sign in to comment.