Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Small inline_template refactoring (use binread).

  • Loading branch information...
commit e6fd541db3031540d7e4c210330018bfee704637 1 parent 8240bb7
@rkh rkh authored
Showing with 1 addition and 3 deletions.
  1. +1 −3 lib/sinatra/base.rb
View
4 lib/sinatra/base.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.