lib/bunch/middleware.rb in bunch-0.0.7 vs lib/bunch/middleware.rb in bunch-0.0.8
- old
+ new
@@ -1,10 +1,10 @@
# heavily inspired by Rack::URLMap
module Bunch
class Middleware
- attr_accessor :app
+ attr_accessor :app, :endpoint
def initialize(app, options={})
unless options[:root_url] && options[:path]
raise "Must provide :root_url and :path"
end
@@ -14,10 +14,10 @@
@endpoint = Bunch::Rack.new(options.delete(:path), options)
end
def call(env)
path = env['PATH_INFO'].to_s
- script_name = env['SCRIPT_NAME']
+ script_name = env['SCRIPT_NAME'].to_s
if path =~ root_regexp &&
(rest = $1) &&
(rest.empty? || rest[0] == ?/)