class Sinatra::Base
def static!
Attempt to serve static files from public directory. Throws :halt when
def static! return if (public_dir = settings.public).nil? public_dir = File.expand_path(public_dir) path = File.expand_path(public_dir + unescape(request.path_info)) return if path[0, public_dir.length] != public_dir return unless File.file?(path) env['sinatra.static_file'] = path send_file path, :disposition => nil end