ok
Direktori : /opt/cpanel/ea-ruby27/root/usr/share/gems/doc/rack-2.2.8/rdoc/Rack/Response/ |
Current File : //opt/cpanel/ea-ruby27/root/usr/share/gems/doc/rack-2.2.8/rdoc/Rack/Response/Helpers.html |
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>module Rack::Response::Helpers - rack-2.2.8 Documentation</title> <script type="text/javascript"> var rdoc_rel_prefix = "../../"; var index_rel_prefix = "../../"; </script> <script src="../../js/navigation.js" defer></script> <script src="../../js/search.js" defer></script> <script src="../../js/search_index.js" defer></script> <script src="../../js/searcher.js" defer></script> <script src="../../js/darkfish.js" defer></script> <link href="../../css/fonts.css" rel="stylesheet"> <link href="../../css/rdoc.css" rel="stylesheet"> <body id="top" role="document" class="module"> <nav role="navigation"> <div id="project-navigation"> <div id="home-section" role="region" title="Quick navigation" class="nav-section"> <h2> <a href="../../index.html" rel="home">Home</a> </h2> <div id="table-of-contents-navigation"> <a href="../../table_of_contents.html#pages">Pages</a> <a href="../../table_of_contents.html#classes">Classes</a> <a href="../../table_of_contents.html#methods">Methods</a> </div> </div> <div id="search-section" role="search" class="project-section initially-hidden"> <form action="#" method="get" accept-charset="utf-8"> <div id="search-field-wrapper"> <input id="search-field" role="combobox" aria-label="Search" aria-autocomplete="list" aria-controls="search-results" type="text" name="search" placeholder="Search" spellcheck="false" title="Type to search, Up and Down to navigate, Enter to load"> </div> <ul id="search-results" aria-label="Search Results" aria-busy="false" aria-expanded="false" aria-atomic="false" class="initially-hidden"></ul> </form> </div> </div> <div id="class-metadata"> <!-- Method Quickref --> <div id="method-list-section" class="nav-section"> <h3>Methods</h3> <ul class="link-list" role="directory"> <li ><a href="#method-i-accepted-3F">#accepted?</a> <li ><a href="#method-i-add_header">#add_header</a> <li ><a href="#method-i-append">#append</a> <li ><a href="#method-i-bad_request-3F">#bad_request?</a> <li ><a href="#method-i-buffered_body-21">#buffered_body!</a> <li ><a href="#method-i-cache-21">#cache!</a> <li ><a href="#method-i-cache_control">#cache_control</a> <li ><a href="#method-i-cache_control-3D">#cache_control=</a> <li ><a href="#method-i-client_error-3F">#client_error?</a> <li ><a href="#method-i-content_length">#content_length</a> <li ><a href="#method-i-content_type">#content_type</a> <li ><a href="#method-i-content_type-3D">#content_type=</a> <li ><a href="#method-i-created-3F">#created?</a> <li ><a href="#method-i-delete_cookie">#delete_cookie</a> <li ><a href="#method-i-do_not_cache-21">#do_not_cache!</a> <li ><a href="#method-i-etag">#etag</a> <li ><a href="#method-i-etag-3D">#etag=</a> <li ><a href="#method-i-forbidden-3F">#forbidden?</a> <li ><a href="#method-i-include-3F">#include?</a> <li ><a href="#method-i-informational-3F">#informational?</a> <li ><a href="#method-i-invalid-3F">#invalid?</a> <li ><a href="#method-i-location">#location</a> <li ><a href="#method-i-location-3D">#location=</a> <li ><a href="#method-i-media_type">#media_type</a> <li ><a href="#method-i-media_type_params">#media_type_params</a> <li ><a href="#method-i-method_not_allowed-3F">#method_not_allowed?</a> <li ><a href="#method-i-moved_permanently-3F">#moved_permanently?</a> <li ><a href="#method-i-no_content-3F">#no_content?</a> <li ><a href="#method-i-not_found-3F">#not_found?</a> <li ><a href="#method-i-ok-3F">#ok?</a> <li ><a href="#method-i-precondition_failed-3F">#precondition_failed?</a> <li ><a href="#method-i-redirect-3F">#redirect?</a> <li ><a href="#method-i-redirection-3F">#redirection?</a> <li ><a href="#method-i-server_error-3F">#server_error?</a> <li ><a href="#method-i-set_cookie">#set_cookie</a> <li ><a href="#method-i-set_cookie_header">#set_cookie_header</a> <li ><a href="#method-i-set_cookie_header-3D">#set_cookie_header=</a> <li ><a href="#method-i-successful-3F">#successful?</a> <li ><a href="#method-i-unauthorized-3F">#unauthorized?</a> <li ><a href="#method-i-unprocessable-3F">#unprocessable?</a> </ul> </div> </div> </nav> <main role="main" aria-labelledby="module-Rack::Response::Helpers"> <h1 id="module-Rack::Response::Helpers" class="module"> module Rack::Response::Helpers </h1> <section class="description"> </section> <section id="5Buntitled-5D" class="documentation-section"> <section id="public-instance-5Buntitled-5D-method-details" class="method-section"> <header> <h3>Public Instance Methods</h3> </header> <div id="method-i-accepted-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">accepted?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="accepted-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 145</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">accepted?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">202</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-add_header" class="method-detail "> <div class="method-heading"> <span class="method-name">add_header</span><span class="method-args">(key, v)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Add a header that may have multiple values.</p> <p>Example:</p> <pre class="ruby"><span class="ruby-identifier">response</span>.<span class="ruby-identifier">add_header</span> <span class="ruby-string">'Vary'</span>, <span class="ruby-string">'Accept-Encoding'</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">add_header</span> <span class="ruby-string">'Vary'</span>, <span class="ruby-string">'Cookie'</span> <span class="ruby-identifier">assert_equal</span> <span class="ruby-string">'Accept-Encoding,Cookie'</span>, <span class="ruby-identifier">response</span>.<span class="ruby-identifier">get_header</span>(<span class="ruby-string">'Vary'</span>) </pre> <p><a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2">www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2</a></p> <div class="method-source-code" id="add_header-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 171</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_header</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">v</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-identifier">get_header</span> <span class="ruby-identifier">key</span> <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">has_header?</span> <span class="ruby-identifier">key</span> <span class="ruby-identifier">set_header</span> <span class="ruby-identifier">key</span>, <span class="ruby-node">"#{get_header key},#{v}"</span> <span class="ruby-keyword">else</span> <span class="ruby-identifier">set_header</span> <span class="ruby-identifier">key</span>, <span class="ruby-identifier">v</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-bad_request-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">bad_request?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="bad_request-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 148</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">bad_request?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">400</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-cache-21" class="method-detail "> <div class="method-heading"> <span class="method-name">cache!</span><span class="method-args">(duration = 3600, directive: "public")</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Specify that the content should be cached. @param duration [Integer] The number of seconds until the cache expires. @option directive [String] The cache control directive, one of “public”, “private”, “no-cache” or “no-store”.</p> <div class="method-source-code" id="cache-21-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 246</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">cache!</span>(<span class="ruby-identifier">duration</span> = <span class="ruby-value">3600</span>, <span class="ruby-value">directive:</span> <span class="ruby-string">"public"</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">headers</span>[<span class="ruby-constant">CACHE_CONTROL</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp">/no-cache/</span> <span class="ruby-identifier">set_header</span> <span class="ruby-constant">CACHE_CONTROL</span>, <span class="ruby-node">"#{directive}, max-age=#{duration}"</span> <span class="ruby-identifier">set_header</span> <span class="ruby-constant">EXPIRES</span>, (<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">duration</span>).<span class="ruby-identifier">httpdate</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-cache_control" class="method-detail "> <div class="method-heading"> <span class="method-name">cache_control</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="cache_control-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 229</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">cache_control</span> <span class="ruby-identifier">get_header</span> <span class="ruby-constant">CACHE_CONTROL</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-cache_control-3D" class="method-detail "> <div class="method-heading"> <span class="method-name">cache_control=</span><span class="method-args">(v)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="cache_control-3D-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 233</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">cache_control=</span>(<span class="ruby-identifier">v</span>) <span class="ruby-identifier">set_header</span> <span class="ruby-constant">CACHE_CONTROL</span>, <span class="ruby-identifier">v</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-client_error-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">client_error?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="client_error-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 140</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">client_error?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">>=</span> <span class="ruby-value">400</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">status</span> <span class="ruby-operator"><</span> <span class="ruby-value">500</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-content_length" class="method-detail "> <div class="method-heading"> <span class="method-name">content_length</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="content_length-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 199</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">content_length</span> <span class="ruby-identifier">cl</span> = <span class="ruby-identifier">get_header</span> <span class="ruby-constant">CONTENT_LENGTH</span> <span class="ruby-identifier">cl</span> <span class="ruby-operator">?</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> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-content_type" class="method-detail "> <div class="method-heading"> <span class="method-name">content_type</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Get the content type of the response.</p> <div class="method-source-code" id="content_type-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 182</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">content_type</span> <span class="ruby-identifier">get_header</span> <span class="ruby-constant">CONTENT_TYPE</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-content_type-3D" class="method-detail "> <div class="method-heading"> <span class="method-name">content_type=</span><span class="method-args">(content_type)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Set the content type of the response.</p> <div class="method-source-code" id="content_type-3D-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 187</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">content_type=</span>(<span class="ruby-identifier">content_type</span>) <span class="ruby-identifier">set_header</span> <span class="ruby-constant">CONTENT_TYPE</span>, <span class="ruby-identifier">content_type</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-created-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">created?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="created-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 144</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">created?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">201</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-delete_cookie" class="method-detail "> <div class="method-heading"> <span class="method-name">delete_cookie</span><span class="method-args">(key, value = {})</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="delete_cookie-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 217</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_cookie</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span> = {}) <span class="ruby-identifier">set_header</span> <span class="ruby-constant">SET_COOKIE</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">add_remove_cookie_to_header</span>(<span class="ruby-identifier">get_header</span>(<span class="ruby-constant">SET_COOKIE</span>), <span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>) <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-do_not_cache-21" class="method-detail "> <div class="method-heading"> <span class="method-name">do_not_cache!</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Specifies that the content shouldn't be cached. Overrides `cache!` if already called.</p> <div class="method-source-code" id="do_not_cache-21-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 238</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">do_not_cache!</span> <span class="ruby-identifier">set_header</span> <span class="ruby-constant">CACHE_CONTROL</span>, <span class="ruby-string">"no-cache, must-revalidate"</span> <span class="ruby-identifier">set_header</span> <span class="ruby-constant">EXPIRES</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">httpdate</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-etag" class="method-detail "> <div class="method-heading"> <span class="method-name">etag</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="etag-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 253</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">etag</span> <span class="ruby-identifier">get_header</span> <span class="ruby-constant">ETAG</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-etag-3D" class="method-detail "> <div class="method-heading"> <span class="method-name">etag=</span><span class="method-args">(v)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="etag-3D-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 257</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">etag=</span>(<span class="ruby-identifier">v</span>) <span class="ruby-identifier">set_header</span> <span class="ruby-constant">ETAG</span>, <span class="ruby-identifier">v</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-forbidden-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">forbidden?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="forbidden-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 150</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">forbidden?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">403</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-include-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">include?</span><span class="method-args">(header)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="include-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 158</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">include?</span>(<span class="ruby-identifier">header</span>) <span class="ruby-identifier">has_header?</span> <span class="ruby-identifier">header</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-informational-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">informational?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="informational-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 137</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">informational?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">>=</span> <span class="ruby-value">100</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">status</span> <span class="ruby-operator"><</span> <span class="ruby-value">200</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-invalid-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">invalid?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="invalid-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 135</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">invalid?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator"><</span> <span class="ruby-value">100</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">>=</span> <span class="ruby-value">600</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-location" class="method-detail "> <div class="method-heading"> <span class="method-name">location</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="location-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 204</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">location</span> <span class="ruby-identifier">get_header</span> <span class="ruby-string">"Location"</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-location-3D" class="method-detail "> <div class="method-heading"> <span class="method-name">location=</span><span class="method-args">(location)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="location-3D-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 208</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">location=</span>(<span class="ruby-identifier">location</span>) <span class="ruby-identifier">set_header</span> <span class="ruby-string">"Location"</span>, <span class="ruby-identifier">location</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-media_type" class="method-detail "> <div class="method-heading"> <span class="method-name">media_type</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="media_type-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 191</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">media_type</span> <span class="ruby-constant">MediaType</span>.<span class="ruby-identifier">type</span>(<span class="ruby-identifier">content_type</span>) <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-media_type_params" class="method-detail "> <div class="method-heading"> <span class="method-name">media_type_params</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="media_type_params-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 195</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">media_type_params</span> <span class="ruby-constant">MediaType</span>.<span class="ruby-identifier">params</span>(<span class="ruby-identifier">content_type</span>) <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-method_not_allowed-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">method_not_allowed?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="method_not_allowed-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 152</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">method_not_allowed?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">405</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-moved_permanently-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">moved_permanently?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="moved_permanently-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 147</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">moved_permanently?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">301</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-no_content-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">no_content?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="no_content-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 146</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">no_content?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">204</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-not_found-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">not_found?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="not_found-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 151</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">not_found?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">404</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-ok-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">ok?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="ok-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 143</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ok?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">200</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-precondition_failed-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">precondition_failed?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="precondition_failed-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 153</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">precondition_failed?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">412</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-redirect-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">redirect?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="redirect-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 156</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">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-value">308</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">status</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-redirection-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">redirection?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="redirection-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 139</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">redirection?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">>=</span> <span class="ruby-value">300</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">status</span> <span class="ruby-operator"><</span> <span class="ruby-value">400</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-server_error-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">server_error?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="server_error-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 141</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">server_error?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">>=</span> <span class="ruby-value">500</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">status</span> <span class="ruby-operator"><</span> <span class="ruby-value">600</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-set_cookie" class="method-detail "> <div class="method-heading"> <span class="method-name">set_cookie</span><span class="method-args">(key, value)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="set_cookie-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 212</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_cookie</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>) <span class="ruby-identifier">cookie_header</span> = <span class="ruby-identifier">get_header</span> <span class="ruby-constant">SET_COOKIE</span> <span class="ruby-identifier">set_header</span> <span class="ruby-constant">SET_COOKIE</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">add_cookie_to_header</span>(<span class="ruby-identifier">cookie_header</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>) <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-set_cookie_header" class="method-detail "> <div class="method-heading"> <span class="method-name">set_cookie_header</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="set_cookie_header-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 221</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_cookie_header</span> <span class="ruby-identifier">get_header</span> <span class="ruby-constant">SET_COOKIE</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-set_cookie_header-3D" class="method-detail "> <div class="method-heading"> <span class="method-name">set_cookie_header=</span><span class="method-args">(v)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="set_cookie_header-3D-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 225</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_cookie_header=</span>(<span class="ruby-identifier">v</span>) <span class="ruby-identifier">set_header</span> <span class="ruby-constant">SET_COOKIE</span>, <span class="ruby-identifier">v</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-successful-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">successful?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="successful-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 138</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">successful?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">>=</span> <span class="ruby-value">200</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">status</span> <span class="ruby-operator"><</span> <span class="ruby-value">300</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-unauthorized-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">unauthorized?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="unauthorized-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 149</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">unauthorized?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">401</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-unprocessable-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">unprocessable?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="unprocessable-3F-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 154</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">unprocessable?</span>; <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">422</span>; <span class="ruby-keyword">end</span></pre> </div> </div> </div> </section> <section id="protected-instance-5Buntitled-5D-method-details" class="method-section"> <header> <h3>Protected Instance Methods</h3> </header> <div id="method-i-append" class="method-detail "> <div class="method-heading"> <span class="method-name">append</span><span class="method-args">(chunk)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="append-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 287</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">append</span>(<span class="ruby-identifier">chunk</span>) <span class="ruby-ivar">@body</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">chunk</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">chunked?</span> <span class="ruby-ivar">@length</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">bytesize</span> <span class="ruby-identifier">set_header</span>(<span class="ruby-constant">CONTENT_LENGTH</span>, <span class="ruby-ivar">@length</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword">end</span> <span class="ruby-keyword">return</span> <span class="ruby-identifier">chunk</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-buffered_body-21" class="method-detail "> <div class="method-heading"> <span class="method-name">buffered_body!</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="buffered_body-21-source"> <pre><span class="ruby-comment"># File lib/rack/response.rb, line 263</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">buffered_body!</span> <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@buffered</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-comment"># The user supplied body was an array:</span> <span class="ruby-ivar">@body</span> = <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">compact</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@length</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">part</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">bytesize</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">else</span> <span class="ruby-comment"># Turn the user supplied body into a buffered array:</span> <span class="ruby-identifier">body</span> = <span class="ruby-ivar">@body</span> <span class="ruby-ivar">@body</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@writer</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">part</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword">end</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:close</span>) <span class="ruby-keyword">end</span> <span class="ruby-ivar">@buffered</span> = <span class="ruby-keyword">true</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> </section> </section> </main> <footer id="validator-badges" role="contentinfo"> <p><a href="https://validator.w3.org/check/referer">Validate</a> <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.1. <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>. </footer>