Class

Rack::Directory

Inheritance
< Object

Rack::Directory serves entries below the root given, according to the path info of the Rack request. If a directory is found, the file‘s contents will be presented in an html based index. If a file is found, the env will be passed to the specified app.

If app is not specified, a Rack::File of the same root will be used.

Constants

Name   Description
DIR_FILE = "<tr><td class='name'><a href='%s'>%s</a></td><td class='size'>%s</td><td class='type'>%s</td><td class='mtime'>%s</td></tr>"
DIR_PAGE = <<-PAGE <html><head> <title>%s</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <style type='text/css'> table { width:100%%; } .name { text-align:left; } .size, .mtime { text-align:right; } .type { width:11em; } .mtime { width:15em; } </style> </head><body> <h1>%s</h1> <hr /> <table> <tr> <th class='name'>Name</th> <th class='size'>Size</th> <th class='type'>Type</th> <th class='mtime'>Last Modified</th> </tr> %s </table> <hr /> </body></html> PAGE
F = ::File
FILESIZE_FORMAT = [ ['%.1fT', 1 << 40], ['%.1fG', 1 << 30], ['%.1fM', 1 << 20], ['%.1fK', 1 << 10], ] Stolen from Ramaze

Attributes

Name Visibility R/W Description
files public R
path public RW
root public RW

Methods

Class

Visibility Signature
public new (root, app=nil)

Instance

Visibility Signature
public _call (env)
public call (env)
public check_forbidden ()
public each () {|l| ...}
public entity_not_found ()
public filesize_format (int)
public list_directory ()
public list_path ()
public stat (node, max = 10)

Class Method Detail

new(root, app=nil)

Instance Method Detail

_call(env)

call(env)

check_forbidden()

each() {|l| ...}

entity_not_found()

filesize_format(int)

list_directory()

list_path()

TODO: add correct response if not readable, not sure if 404 is the best

      option

stat(node, max = 10)