diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index 1c1c1b3d..c6327533 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -637,7 +637,7 @@ module Sinatra file ||= caller_files.first begin - data = ::IO.read(file).split('__END__')[1] + data = ::IO.read(file).split(/^__END__$/)[1] rescue data = nil end diff --git a/test/templates_test.rb b/test/templates_test.rb index 25db7630..2958ef0e 100644 --- a/test/templates_test.rb +++ b/test/templates_test.rb @@ -87,6 +87,8 @@ class TemplatesTest < Test::Unit::TestCase end end +# __END__ : this is not the real end of the script. + __END__ @@ foo