Permalink
Browse files

Small inline_template refactoring (use binread).

  • Loading branch information...
rkh committed Dec 13, 2010
1 parent b0594a2 commit 161324237aec3a525823678f8c665474bdb5837b
Showing with 1 addition and 3 deletions.
  1. +1 −3 lib/sinatra/base.rb
View
@@ -910,9 +910,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 1613242

Please sign in to comment.