summary refs log tree commit
path: root/lib/rack/builder.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rack/builder.rb')
-rw-r--r--lib/rack/builder.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/rack/builder.rb b/lib/rack/builder.rb
index f769b5fd..530f0aaf 100644
--- a/lib/rack/builder.rb
+++ b/lib/rack/builder.rb
@@ -24,19 +24,21 @@ module Rack
   # You can use +map+ to construct a Rack::URLMap in a convenient way.
 
   class Builder
-    def self.parse_file(config, opts = nil)
+    def self.parse_file(config, opts = Server::Options.new)
+      options = {}
       if config =~ /\.ru$/
         cfgfile = ::File.read(config)
         if cfgfile[/^#\\(.*)/] && opts
-          opts.parse! $1.split(/\s+/)
+          options = opts.parse! $1.split(/\s+/)
         end
         cfgfile.sub!(/^__END__\n.*/, '')
-        eval "Rack::Builder.new {( " + cfgfile + "\n )}.to_app",
+        app = eval "Rack::Builder.new {( " + cfgfile + "\n )}.to_app",
           TOPLEVEL_BINDING, config
       else
         require config
-        Object.const_get(::File.basename(config, '.rb').capitalize)
+        app = Object.const_get(::File.basename(config, '.rb').capitalize)
       end
+      return app, options
     end
 
     def initialize(&block)