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
/
Cascade.src
/
Filename :
M000382.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> <head> <title>call (Rack::Cascade)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> <pre><span class="ruby-comment cmt"># File lib/rack/cascade.rb, line 19</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>) <span class="ruby-identifier">result</span> = <span class="ruby-constant">NotFound</span> <span class="ruby-identifier">last_body</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-ivar">@apps</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">app</span><span class="ruby-operator">|</span> <span class="ruby-comment cmt"># The SPEC says that the body must be closed after it has been iterated</span> <span class="ruby-comment cmt"># by the server, or if it is replaced by a middleware action. Cascade</span> <span class="ruby-comment cmt"># replaces the body each time a cascade happens. It is assumed that nil</span> <span class="ruby-comment cmt"># does not respond to close, otherwise the previous application body</span> <span class="ruby-comment cmt"># will be closed. The final application body will not be closed, as it</span> <span class="ruby-comment cmt"># will be passed to the server as a result.</span> <span class="ruby-identifier">last_body</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">last_body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:close</span> <span class="ruby-identifier">result</span> = <span class="ruby-identifier">app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>) <span class="ruby-identifier">last_body</span> = <span class="ruby-identifier">result</span>[<span class="ruby-value">2</span>] <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@catch</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">result</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_i</span>) <span class="ruby-keyword kw">end</span> <span class="ruby-identifier">result</span> <span class="ruby-keyword kw">end</span></pre> </body> </html>