Better handling of in file templates
`__END__` in the middle of lines should not be recognized as the end of the ruby script. Ruby only accepts the line just contain `__END__`. Beginning/tailing whitespaces are not allowed. Signed-off-by: Simon Rozet <simon@rozet.name>
This commit is contained in:
parent
b88c0f579a
commit
64d852ea6f
|
@ -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
|
||||
|
|
|
@ -87,6 +87,8 @@ class TemplatesTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
# __END__ : this is not the real end of the script.
|
||||
|
||||
__END__
|
||||
|
||||
@@ foo
|
||||
|
|
Loading…
Reference in New Issue