D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby18
/
lib64
/
ruby
/
gems
/
1.8
/
doc
/
rack-1.6.1
/
rdoc
/
classes
/
Rack
/
Filename :
Directory.html
back
Copy
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Class: Rack::Directory</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> <script type="text/javascript"> // <![CDATA[ function popupCode( url ) { window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") } function toggleCode( id ) { if ( document.getElementById ) elem = document.getElementById( id ); else if ( document.all ) elem = eval( "document.all." + id ); else return false; elemStyle = elem.style; if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else { elemStyle.display = "none" } return true; } // Make codeblocks hidden by default document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) // ]]> </script> </head> <body> <div id="classHeader"> <table class="header-table"> <tr class="top-aligned-row"> <td><strong>Class</strong></td> <td class="class-name-in-header">Rack::Directory</td> </tr> <tr class="top-aligned-row"> <td><strong>In:</strong></td> <td> <a href="../../files/lib/rack/directory_rb.html"> lib/rack/directory.rb </a> <br /> </td> </tr> <tr class="top-aligned-row"> <td><strong>Parent:</strong></td> <td> Object </td> </tr> </table> </div> <!-- banner header --> <div id="bodyContent"> <div id="contextContent"> <div id="description"> <p> <a href="Directory.html">Rack::Directory</a> serves entries below the <tt>root</tt> given, according to the path info of the <a href="../Rack.html">Rack</a> 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 <tt>app</tt>. </p> <p> If <tt>app</tt> is not specified, a <a href="File.html">Rack::File</a> of the same <tt>root</tt> will be used. </p> </div> </div> <div id="method-list"> <h3 class="section-bar">Methods</h3> <div class="name-list"> <a href="#M000431">_call</a> <a href="#M000430">call</a> <a href="#M000432">check_forbidden</a> <a href="#M000437">each</a> <a href="#M000436">entity_not_found</a> <a href="#M000438">filesize_format</a> <a href="#M000433">list_directory</a> <a href="#M000435">list_path</a> <a href="#M000429">new</a> <a href="#M000434">stat</a> </div> </div> </div> <!-- if includes --> <div id="section"> <div id="constants-list"> <h3 class="section-bar">Constants</h3> <div class="name-list"> <table summary="Constants"> <tr class="top-aligned-row context-row"> <td class="context-item-name">DIR_FILE</td> <td>=</td> <td class="context-item-value">"<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>"</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">DIR_PAGE</td> <td>=</td> <td class="context-item-value"><<-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</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">F</td> <td>=</td> <td class="context-item-value">::File</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">FILESIZE_FORMAT</td> <td>=</td> <td class="context-item-value">[ ['%.1fT', 1 << 40], ['%.1fG', 1 << 30], ['%.1fM', 1 << 20], ['%.1fK', 1 << 10], ]</td> <td width="3em"> </td> <td class="context-item-desc"> Stolen from Ramaze </td> </tr> </table> </div> </div> <div id="attribute-list"> <h3 class="section-bar">Attributes</h3> <div class="name-list"> <table> <tr class="top-aligned-row context-row"> <td class="context-item-name">files</td> <td class="context-item-value"> [R] </td> <td class="context-item-desc"></td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">path</td> <td class="context-item-value"> [RW] </td> <td class="context-item-desc"></td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">root</td> <td class="context-item-value"> [RW] </td> <td class="context-item-desc"></td> </tr> </table> </div> </div> <!-- if method_list --> <div id="methods"> <h3 class="section-bar">Public Class methods</h3> <div id="method-M000429" class="method-detail"> <a name="M000429"></a> <div class="method-heading"> <a href="Directory.src/M000429.html" target="Code" class="method-signature" onclick="popupCode('Directory.src/M000429.html');return false;"> <span class="method-name">new</span><span class="method-args">(root, app=nil)</span> </a> </div> <div class="method-description"> </div> </div> <h3 class="section-bar">Public Instance methods</h3> <div id="method-M000431" class="method-detail"> <a name="M000431"></a> <div class="method-heading"> <a href="Directory.src/M000431.html" target="Code" class="method-signature" onclick="popupCode('Directory.src/M000431.html');return false;"> <span class="method-name">_call</span><span class="method-args">(env)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000430" class="method-detail"> <a name="M000430"></a> <div class="method-heading"> <a href="Directory.src/M000430.html" target="Code" class="method-signature" onclick="popupCode('Directory.src/M000430.html');return false;"> <span class="method-name">call</span><span class="method-args">(env)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000432" class="method-detail"> <a name="M000432"></a> <div class="method-heading"> <a href="Directory.src/M000432.html" target="Code" class="method-signature" onclick="popupCode('Directory.src/M000432.html');return false;"> <span class="method-name">check_forbidden</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000437" class="method-detail"> <a name="M000437"></a> <div class="method-heading"> <a href="Directory.src/M000437.html" target="Code" class="method-signature" onclick="popupCode('Directory.src/M000437.html');return false;"> <span class="method-name">each</span><span class="method-args">() {|l| ...}</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000436" class="method-detail"> <a name="M000436"></a> <div class="method-heading"> <a href="Directory.src/M000436.html" target="Code" class="method-signature" onclick="popupCode('Directory.src/M000436.html');return false;"> <span class="method-name">entity_not_found</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000438" class="method-detail"> <a name="M000438"></a> <div class="method-heading"> <a href="Directory.src/M000438.html" target="Code" class="method-signature" onclick="popupCode('Directory.src/M000438.html');return false;"> <span class="method-name">filesize_format</span><span class="method-args">(int)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000433" class="method-detail"> <a name="M000433"></a> <div class="method-heading"> <a href="Directory.src/M000433.html" target="Code" class="method-signature" onclick="popupCode('Directory.src/M000433.html');return false;"> <span class="method-name">list_directory</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000435" class="method-detail"> <a name="M000435"></a> <div class="method-heading"> <a href="Directory.src/M000435.html" target="Code" class="method-signature" onclick="popupCode('Directory.src/M000435.html');return false;"> <span class="method-name">list_path</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> TODO: add correct response if not readable, not sure if 404 is the best </p> <pre> option </pre> </div> </div> <div id="method-M000434" class="method-detail"> <a name="M000434"></a> <div class="method-heading"> <a href="Directory.src/M000434.html" target="Code" class="method-signature" onclick="popupCode('Directory.src/M000434.html');return false;"> <span class="method-name">stat</span><span class="method-args">(node, max = 10)</span> </a> </div> <div class="method-description"> </div> </div> </div> </div> <div id="validator-badges"> <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> </div> </body> </html>