479 lines
19 KiB
HTML
479 lines
19 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>Module: Rack::Response::Helpers</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>Module</strong></td>
|
||
|
<td class="class-name-in-header">Rack::Response::Helpers</td>
|
||
|
</tr>
|
||
|
<tr class="top-aligned-row">
|
||
|
<td><strong>In:</strong></td>
|
||
|
<td>
|
||
|
<a href="../../../files/lib/rack/response_rb.html">
|
||
|
lib/rack/response.rb
|
||
|
</a>
|
||
|
<br />
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
</table>
|
||
|
</div>
|
||
|
<!-- banner header -->
|
||
|
|
||
|
<div id="bodyContent">
|
||
|
|
||
|
|
||
|
|
||
|
<div id="contextContent">
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div id="method-list">
|
||
|
<h3 class="section-bar">Methods</h3>
|
||
|
|
||
|
<div class="name-list">
|
||
|
<a href="#M000103">client_error?</a>
|
||
|
<a href="#M000112">content_length</a>
|
||
|
<a href="#M000111">content_type</a>
|
||
|
<a href="#M000109">empty?</a>
|
||
|
<a href="#M000106">forbidden?</a>
|
||
|
<a href="#M000110">include?</a>
|
||
|
<a href="#M000100">informational?</a>
|
||
|
<a href="#M000099">invalid?</a>
|
||
|
<a href="#M000113">location</a>
|
||
|
<a href="#M000107">not_found?</a>
|
||
|
<a href="#M000105">ok?</a>
|
||
|
<a href="#M000108">redirect?</a>
|
||
|
<a href="#M000102">redirection?</a>
|
||
|
<a href="#M000104">server_error?</a>
|
||
|
<a href="#M000101">successful?</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<!-- if includes -->
|
||
|
|
||
|
<div id="section">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<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">headers</td>
|
||
|
<td class="context-item-value"> [R] </td>
|
||
|
<td class="context-item-desc">
|
||
|
Headers
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="top-aligned-row context-row">
|
||
|
<td class="context-item-name">original_headers</td>
|
||
|
<td class="context-item-value"> [R] </td>
|
||
|
<td class="context-item-desc">
|
||
|
Headers
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
<!-- if method_list -->
|
||
|
<div id="methods">
|
||
|
<h3 class="section-bar">Public Instance methods</h3>
|
||
|
|
||
|
<div id="method-M000103" class="method-detail">
|
||
|
<a name="M000103"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000103" class="method-signature">
|
||
|
<span class="method-name">client_error?</span><span class="method-args">()</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000103-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000103-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 138</span>
|
||
|
138: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">client_error?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">>=</span> <span class="ruby-value">400</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@status</span> <span class="ruby-operator"><</span> <span class="ruby-value">500</span>; <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000112" class="method-detail">
|
||
|
<a name="M000112"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000112" class="method-signature">
|
||
|
<span class="method-name">content_length</span><span class="method-args">()</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000112-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000112-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 159</span>
|
||
|
159: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_length</span>
|
||
|
160: <span class="ruby-identifier">cl</span> = <span class="ruby-identifier">headers</span>[<span class="ruby-value str">"Content-Length"</span>]
|
||
|
161: <span class="ruby-identifier">cl</span> <span class="ruby-value">? </span><span class="ruby-identifier">cl</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">cl</span>
|
||
|
162: <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000111" class="method-detail">
|
||
|
<a name="M000111"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000111" class="method-signature">
|
||
|
<span class="method-name">content_type</span><span class="method-args">()</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000111-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000111-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 155</span>
|
||
|
155: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_type</span>
|
||
|
156: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">"Content-Type"</span>]
|
||
|
157: <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000109" class="method-detail">
|
||
|
<a name="M000109"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000109" class="method-signature">
|
||
|
<span class="method-name">empty?</span><span class="method-args">()</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000109-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000109-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 146</span>
|
||
|
146: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">empty?</span>; [<span class="ruby-value">201</span>, <span class="ruby-value">204</span>, <span class="ruby-value">304</span>].<span class="ruby-identifier">include?</span> <span class="ruby-ivar">@status</span>; <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000106" class="method-detail">
|
||
|
<a name="M000106"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000106" class="method-signature">
|
||
|
<span class="method-name">forbidden?</span><span class="method-args">()</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000106-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000106-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 142</span>
|
||
|
142: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">forbidden?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">==</span> <span class="ruby-value">403</span>; <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000110" class="method-detail">
|
||
|
<a name="M000110"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000110" class="method-signature">
|
||
|
<span class="method-name">include?</span><span class="method-args">(header)</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000110-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000110-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 151</span>
|
||
|
151: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include?</span>(<span class="ruby-identifier">header</span>)
|
||
|
152: <span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-identifier">headers</span>[<span class="ruby-identifier">header</span>]
|
||
|
153: <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000100" class="method-detail">
|
||
|
<a name="M000100"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000100" class="method-signature">
|
||
|
<span class="method-name">informational?</span><span class="method-args">()</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000100-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000100-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 135</span>
|
||
|
135: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">informational?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">>=</span> <span class="ruby-value">100</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@status</span> <span class="ruby-operator"><</span> <span class="ruby-value">200</span>; <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000099" class="method-detail">
|
||
|
<a name="M000099"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000099" class="method-signature">
|
||
|
<span class="method-name">invalid?</span><span class="method-args">()</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000099-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000099-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 133</span>
|
||
|
133: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">invalid?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator"><</span> <span class="ruby-value">100</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@status</span> <span class="ruby-operator">>=</span> <span class="ruby-value">600</span>; <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000113" class="method-detail">
|
||
|
<a name="M000113"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000113" class="method-signature">
|
||
|
<span class="method-name">location</span><span class="method-args">()</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000113-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000113-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 164</span>
|
||
|
164: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">location</span>
|
||
|
165: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">"Location"</span>]
|
||
|
166: <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000107" class="method-detail">
|
||
|
<a name="M000107"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000107" class="method-signature">
|
||
|
<span class="method-name">not_found?</span><span class="method-args">()</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000107-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000107-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 143</span>
|
||
|
143: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">not_found?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">==</span> <span class="ruby-value">404</span>; <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000105" class="method-detail">
|
||
|
<a name="M000105"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000105" class="method-signature">
|
||
|
<span class="method-name">ok?</span><span class="method-args">()</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000105-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000105-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 141</span>
|
||
|
141: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ok?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">==</span> <span class="ruby-value">200</span>; <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000108" class="method-detail">
|
||
|
<a name="M000108"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000108" class="method-signature">
|
||
|
<span class="method-name">redirect?</span><span class="method-args">()</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000108-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000108-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 145</span>
|
||
|
145: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">redirect?</span>; [<span class="ruby-value">301</span>, <span class="ruby-value">302</span>, <span class="ruby-value">303</span>, <span class="ruby-value">307</span>].<span class="ruby-identifier">include?</span> <span class="ruby-ivar">@status</span>; <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000102" class="method-detail">
|
||
|
<a name="M000102"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000102" class="method-signature">
|
||
|
<span class="method-name">redirection?</span><span class="method-args">()</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000102-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000102-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 137</span>
|
||
|
137: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">redirection?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">>=</span> <span class="ruby-value">300</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@status</span> <span class="ruby-operator"><</span> <span class="ruby-value">400</span>; <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000104" class="method-detail">
|
||
|
<a name="M000104"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000104" class="method-signature">
|
||
|
<span class="method-name">server_error?</span><span class="method-args">()</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000104-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000104-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 139</span>
|
||
|
139: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">server_error?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">>=</span> <span class="ruby-value">500</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@status</span> <span class="ruby-operator"><</span> <span class="ruby-value">600</span>; <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000101" class="method-detail">
|
||
|
<a name="M000101"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000101" class="method-signature">
|
||
|
<span class="method-name">successful?</span><span class="method-args">()</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000101-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000101-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 136</span>
|
||
|
136: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">successful?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">>=</span> <span class="ruby-value">200</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@status</span> <span class="ruby-operator"><</span> <span class="ruby-value">300</span>; <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>
|