class Sinatra::Base

def static!(options = {})

a matching file is found, returns nil otherwise.
Attempt to serve static files from public directory. Throws :halt when
def static!(options = {})
  return if (public_dir = settings.public_folder).nil?
  path = "#{public_dir}#{URI_INSTANCE.unescape(request.path_info)}"
  return unless valid_path?(path)
  path = File.expand_path(path)
  return unless path.start_with?(File.expand_path(public_dir) + '/')
  return unless File.file?(path)
  env['sinatra.static_file'] = path
  cache_control(*settings.static_cache_control) if settings.static_cache_control?
  send_file path, options.merge(:disposition => nil)
end