module YARD::Server::Commands::StaticFileHelpers

def static_template_file?

Returns:
  • (void) -

Raises:
  • (FinishRequest) - if a file was found and served
def static_template_file?
  # this const was defined in StaticFileCommand originally
  default_mime_types = StaticFileCommand::DefaultMimeTypes
  file = find_file(adapter, path)
  if file
    ext = "." + (path[/\.(\w+)$/, 1] || "html")
    headers['Content-Type'] = mime_type(ext, default_mime_types)
    self.body = File.read(file)
    raise FinishRequest
  end
end