218 lines
8.9 KiB
HTML
218 lines
8.9 KiB
HTML
|
<?xml version="1.0" encoding="utf-8"?>
|
||
|
<!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::Recursive</title>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<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::Recursive</td>
|
||
|
</tr>
|
||
|
<tr class="top-aligned-row">
|
||
|
<td><strong>In:</strong></td>
|
||
|
<td>
|
||
|
<a href="../../files/lib/rack/recursive_rb.html">
|
||
|
lib/rack/recursive.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="Recursive.html">Rack::Recursive</a> allows applications called
|
||
|
down the chain to <a href="Recursive.html#M000149">include</a> data from
|
||
|
other applications (by using <tt><a
|
||
|
href="http://'rack.recursive.include'">rack</a>[…]</tt> or raise a <a
|
||
|
href="ForwardRequest.html">ForwardRequest</a> to redirect internally.
|
||
|
</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div id="method-list">
|
||
|
<h3 class="section-bar">Methods</h3>
|
||
|
|
||
|
<div class="name-list">
|
||
|
<a href="#M000148">call</a>
|
||
|
<a href="#M000149">include</a>
|
||
|
<a href="#M000147">new</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<!-- if includes -->
|
||
|
|
||
|
<div id="section">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<!-- if method_list -->
|
||
|
<div id="methods">
|
||
|
<h3 class="section-bar">Public Class methods</h3>
|
||
|
|
||
|
<div id="method-M000147" class="method-detail">
|
||
|
<a name="M000147"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000147" class="method-signature">
|
||
|
<span class="method-name">new</span><span class="method-args">(app)</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000147-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000147-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/recursive.rb, line 33</span>
|
||
|
33: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>)
|
||
|
34: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
|
||
|
35: <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<h3 class="section-bar">Public Instance methods</h3>
|
||
|
|
||
|
<div id="method-M000148" class="method-detail">
|
||
|
<a name="M000148"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000148" class="method-signature">
|
||
|
<span class="method-name">call</span><span class="method-args">(env)</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000148-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000148-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/recursive.rb, line 37</span>
|
||
|
37: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
|
||
|
38: <span class="ruby-ivar">@script_name</span> = <span class="ruby-identifier">env</span>[<span class="ruby-value str">"SCRIPT_NAME"</span>]
|
||
|
39: <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value str">'rack.recursive.include'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">method</span>(<span class="ruby-identifier">:include</span>)))
|
||
|
40: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ForwardRequest</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">req</span>
|
||
|
41: <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">req</span>.<span class="ruby-identifier">env</span>))
|
||
|
42: <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000149" class="method-detail">
|
||
|
<a name="M000149"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000149" class="method-signature">
|
||
|
<span class="method-name">include</span><span class="method-args">(env, path)</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000149-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000149-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/recursive.rb, line 44</span>
|
||
|
44: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">path</span>)
|
||
|
45: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">index</span>(<span class="ruby-ivar">@script_name</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">&&</span> (<span class="ruby-identifier">path</span>[<span class="ruby-ivar">@script_name</span>.<span class="ruby-identifier">size</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?/</span> <span class="ruby-operator">||</span>
|
||
|
46: <span class="ruby-identifier">path</span>[<span class="ruby-ivar">@script_name</span>.<span class="ruby-identifier">size</span>].<span class="ruby-identifier">nil?</span>)
|
||
|
47: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"can only include below #{@script_name}, not #{path}"</span>
|
||
|
48: <span class="ruby-keyword kw">end</span>
|
||
|
49:
|
||
|
50: <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value str">"PATH_INFO"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">path</span>, <span class="ruby-value str">"SCRIPT_NAME"</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@script_name</span>,
|
||
|
51: <span class="ruby-value str">"REQUEST_METHOD"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"GET"</span>,
|
||
|
52: <span class="ruby-value str">"CONTENT_LENGTH"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"0"</span>, <span class="ruby-value str">"CONTENT_TYPE"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">""</span>,
|
||
|
53: <span class="ruby-value str">"rack.input"</span> =<span class="ruby-operator">></span> <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">""</span>))
|
||
|
54: <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
|
||
|
55: <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</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>
|