class Lurker::Server::TryStatic
fixed rack_contrib implementation
Public Class Methods
new(app, options)
click to toggle source
# File lib/lurker/server.rb, line 8 def initialize(app, options) @app = app @try = ['', *options.delete(:try)] @static = ::Rack::Static.new( proc { [404, {}, []] }, # HERE proc, not lambda options) end
Public Instance Methods
call(env)
click to toggle source
# File lib/lurker/server.rb, line 16 def call(env) orig_path = env['PATH_INFO'] found = nil @try.each do |path| resp = @static.call(env.merge!('PATH_INFO' => orig_path + path)) break if 404 != resp[0] && found = resp end found or @app.call(env.merge!('PATH_INFO' => orig_path)) end