Permalink
Browse files

Rack::Builder: Allow more than one line of DATA-block

  • Loading branch information...
1 parent bd3dcda commit ff47d6a154f50373990f0399b1abfb3026d3f18a @judofyr judofyr committed Oct 13, 2011
Showing with 3 additions and 1 deletion.
  1. +1 −1 lib/rack/builder.rb
  2. +2 −0 test/builder/end.ru
View
2 lib/rack/builder.rb
@@ -36,7 +36,7 @@ def self.parse_file(config, opts = Server::Options.new)
if cfgfile[/^#\\(.*)/] && opts
options = opts.parse! $1.split(/\s+/)
end
- cfgfile.sub!(/^__END__\n.*/, '')
+ cfgfile.sub!(/^__END__\n.*\Z/m, '')
app = eval "Rack::Builder.new {\n" + cfgfile + "\n}.to_app",
TOPLEVEL_BINDING, config
else
View
2 test/builder/end.ru
@@ -1,3 +1,5 @@
run lambda { |env| [200, {'Content-Type' => 'text/plain'}, ['OK']] }
__END__
Should not be evaluated
+Neither should
+This

0 comments on commit ff47d6a

Please sign in to comment.