Method: Mango::Application.render_index_file!

Defined in:
lib/mango/application.rb

.render_index_file!(uri_path) ⇒ Object

Given a URI path, attempts to send an index.html file, if it exists, and halt

Parameters:



504
505
506
507
508
509
510
511
512
513
514
# File 'lib/mango/application.rb', line 504

def render_index_file!(uri_path)
  return unless URI.directory?(uri_path)

  index_match     = File.join(settings.public_dir, "*")
  index_file_path = File.expand_path(uri_path + "index.html", settings.public_dir)

  return unless File.fnmatch(index_match, index_file_path)
  return unless File.file?(index_file_path)

  send_file index_file_path
end