ok

Mini Shell

Direktori : /opt/cpanel/ea-ruby27/root/usr/share/gems/doc/rack-2.2.8/rdoc/Rack/
Upload File :
Current File : //opt/cpanel/ea-ruby27/root/usr/share/gems/doc/rack-2.2.8/rdoc/Rack/QueryParser.html

<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">

<title>class Rack::QueryParser - 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="class">
<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">
    
    <div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  
  <p class="link">Object
  
</div>

    
    
    <!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    
    <li ><a href="#method-c-make_default">::make_default</a>
    
    <li ><a href="#method-c-new">::new</a>
    
    <li ><a href="#method-i-make_params">#make_params</a>
    
    <li ><a href="#method-i-new_depth_limit">#new_depth_limit</a>
    
    <li ><a href="#method-i-new_space_limit">#new_space_limit</a>
    
    <li ><a href="#method-i-normalize_params">#normalize_params</a>
    
    <li ><a href="#method-i-params_hash_has_key-3F">#params_hash_has_key?</a>
    
    <li ><a href="#method-i-params_hash_type-3F">#params_hash_type?</a>
    
    <li ><a href="#method-i-parse_nested_query">#parse_nested_query</a>
    
    <li ><a href="#method-i-parse_query">#parse_query</a>
    
    <li ><a href="#method-i-unescape">#unescape</a>
    
  </ul>
</div>

  </div>
</nav>

<main role="main" aria-labelledby="class-Rack::QueryParser">
  <h1 id="class-Rack::QueryParser" class="class">
    class Rack::QueryParser
  </h1>

  <section class="description">
    
  </section>

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

    

    
    <section class="constants-list">
      <header>
        <h3>Constants</h3>
      </header>
      <dl>
      
        <dt id="COMMON_SEP">COMMON_SEP
        
        <dd>
        
      
        <dt id="DEFAULT_SEP">DEFAULT_SEP
        
        <dd>
        
      
      </dl>
    </section>
    

    
    <section class="attribute-method-details" class="method-section">
      <header>
        <h3>Attributes</h3>
      </header>

      
      <div id="attribute-i-key_space_limit" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">key_space_limit</span><span
            class="attribute-access-type">[R]</span>
        </div>

        <div class="method-description">
        
        
        
        </div>
      </div>
      
      <div id="attribute-i-param_depth_limit" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">param_depth_limit</span><span
            class="attribute-access-type">[R]</span>
        </div>

        <div class="method-description">
        
        
        
        </div>
      </div>
      
    </section>
    

    
     <section id="public-class-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Class Methods</h3>
       </header>

    
      <div id="method-c-make_default" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">make_default</span><span
            class="method-args">(key_space_limit, param_depth_limit)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="make_default-source">
            <pre><span class="ruby-comment"># File lib/rack/query_parser.rb, line 23</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">make_default</span>(<span class="ruby-identifier">key_space_limit</span>, <span class="ruby-identifier">param_depth_limit</span>)
  <span class="ruby-identifier">new</span> <span class="ruby-constant">Params</span>, <span class="ruby-identifier">key_space_limit</span>, <span class="ruby-identifier">param_depth_limit</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-c-new" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">new</span><span
            class="method-args">(params_class, key_space_limit, param_depth_limit)</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/query_parser.rb, line 29</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">params_class</span>, <span class="ruby-identifier">key_space_limit</span>, <span class="ruby-identifier">param_depth_limit</span>)
  <span class="ruby-ivar">@params_class</span> = <span class="ruby-identifier">params_class</span>
  <span class="ruby-ivar">@key_space_limit</span> = <span class="ruby-identifier">key_space_limit</span>
  <span class="ruby-ivar">@param_depth_limit</span> = <span class="ruby-identifier">param_depth_limit</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
     <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Instance Methods</h3>
       </header>

    
      <div id="method-i-make_params" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">make_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="make_params-source">
            <pre><span class="ruby-comment"># File lib/rack/query_parser.rb, line 128</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">make_params</span>
  <span class="ruby-ivar">@params_class</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@key_space_limit</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-new_depth_limit" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">new_depth_limit</span><span
            class="method-args">(param_depth_limit)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="new_depth_limit-source">
            <pre><span class="ruby-comment"># File lib/rack/query_parser.rb, line 136</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">new_depth_limit</span>(<span class="ruby-identifier">param_depth_limit</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@params_class</span>, <span class="ruby-identifier">key_space_limit</span>, <span class="ruby-identifier">param_depth_limit</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-new_space_limit" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">new_space_limit</span><span
            class="method-args">(key_space_limit)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="new_space_limit-source">
            <pre><span class="ruby-comment"># File lib/rack/query_parser.rb, line 132</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">new_space_limit</span>(<span class="ruby-identifier">key_space_limit</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@params_class</span>, <span class="ruby-identifier">key_space_limit</span>, <span class="ruby-identifier">param_depth_limit</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-normalize_params" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">normalize_params</span><span
            class="method-args">(params, name, v, depth)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p><a href="QueryParser.html#method-i-normalize_params"><code>normalize_params</code></a> recursively expands parameters into structural types. If the structural types represented by two different parameter names are in conflict, a <a href="QueryParser/ParameterTypeError.html"><code>ParameterTypeError</code></a> is raised.</p>
          
          

          
          <div class="method-source-code" id="normalize_params-source">
            <pre><span class="ruby-comment"># File lib/rack/query_parser.rb, line 87</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">normalize_params</span>(<span class="ruby-identifier">params</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">v</span>, <span class="ruby-identifier">depth</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ParamsTooDeepError</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">depth</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">0</span>

  <span class="ruby-identifier">name</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r(\A[\[\]]*([^\[\]]+)\]*)</span>
  <span class="ruby-identifier">k</span> = <span class="ruby-node">$1</span> <span class="ruby-operator">||</span> <span class="ruby-string">&#39;&#39;</span>
  <span class="ruby-identifier">after</span> = <span class="ruby-node">$&#39;</span> <span class="ruby-operator">||</span> <span class="ruby-string">&#39;&#39;</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">v</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;[]&quot;</span>
      <span class="ruby-keyword">return</span> <span class="ruby-constant">Array</span>(<span class="ruby-identifier">v</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-keyword">return</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">after</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;&#39;</span>
    <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">after</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;[&quot;</span>
    <span class="ruby-identifier">params</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">v</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">after</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;[]&quot;</span>
    <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator">||=</span> []
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ParameterTypeError</span>, <span class="ruby-node">&quot;expected Array (got #{params[k].class.name}) for param `#{k}&#39;&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
    <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">v</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">after</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r(^\[\]\[([^\[\]]+)\]$)</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">after</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r(^\[\](.+)$)</span>
    <span class="ruby-identifier">child_key</span> = <span class="ruby-node">$1</span>
    <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator">||=</span> []
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ParameterTypeError</span>, <span class="ruby-node">&quot;expected Array (got #{params[k].class.name}) for param `#{k}&#39;&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">params_hash_type?</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">last</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">params_hash_has_key?</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">last</span>, <span class="ruby-identifier">child_key</span>)
      <span class="ruby-identifier">normalize_params</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">last</span>, <span class="ruby-identifier">child_key</span>, <span class="ruby-identifier">v</span>, <span class="ruby-identifier">depth</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">normalize_params</span>(<span class="ruby-identifier">make_params</span>, <span class="ruby-identifier">child_key</span>, <span class="ruby-identifier">v</span>, <span class="ruby-identifier">depth</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">make_params</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ParameterTypeError</span>, <span class="ruby-node">&quot;expected Hash (got #{params[k].class.name}) for param `#{k}&#39;&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">params_hash_type?</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>])
    <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">normalize_params</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>], <span class="ruby-identifier">after</span>, <span class="ruby-identifier">v</span>, <span class="ruby-identifier">depth</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">params</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-parse_nested_query" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">parse_nested_query</span><span
            class="method-args">(qs, d = nil)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p><a href="QueryParser.html#method-i-parse_nested_query"><code>parse_nested_query</code></a> expands a query string into structural types. Supported types are Arrays, Hashes and basic value types. It is possible to supply query strings with parameters of conflicting types, in this case a <a href="QueryParser/ParameterTypeError.html"><code>ParameterTypeError</code></a> is raised. Users are encouraged to return a 400 in this case.</p>
          
          

          
          <div class="method-source-code" id="parse_nested_query-source">
            <pre><span class="ruby-comment"># File lib/rack/query_parser.rb, line 68</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse_nested_query</span>(<span class="ruby-identifier">qs</span>, <span class="ruby-identifier">d</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">params</span> = <span class="ruby-identifier">make_params</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">qs</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">qs</span>.<span class="ruby-identifier">empty?</span>
    (<span class="ruby-identifier">qs</span> <span class="ruby-operator">||</span> <span class="ruby-string">&#39;&#39;</span>).<span class="ruby-identifier">split</span>(<span class="ruby-identifier">d</span> <span class="ruby-operator">?</span> (<span class="ruby-constant">COMMON_SEP</span>[<span class="ruby-identifier">d</span>] <span class="ruby-operator">||</span> <span class="ruby-regexp">/[#{d}] */n</span>) <span class="ruby-operator">:</span> <span class="ruby-constant">DEFAULT_SEP</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span> = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&#39;=&#39;</span>, <span class="ruby-value">2</span>).<span class="ruby-identifier">map!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">s</span>) }

      <span class="ruby-identifier">normalize_params</span>(<span class="ruby-identifier">params</span>, <span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>, <span class="ruby-identifier">param_depth_limit</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">return</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">to_h</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">ArgumentError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidParameterError</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-parse_query" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">parse_query</span><span
            class="method-args">(qs, d = nil, &amp;unescaper)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Stolen from Mongrel, with some small modifications: Parses a query string by breaking it up at the &#39;&amp;&#39; and &#39;;&#39; characters.  You can also use this to parse cookies by changing the characters used in the second parameter (which defaults to &#39;&amp;;&#39;).</p>
          
          

          
          <div class="method-source-code" id="parse_query-source">
            <pre><span class="ruby-comment"># File lib/rack/query_parser.rb, line 40</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse_query</span>(<span class="ruby-identifier">qs</span>, <span class="ruby-identifier">d</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">unescaper</span>)
  <span class="ruby-identifier">unescaper</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">method</span>(<span class="ruby-value">:unescape</span>)

  <span class="ruby-identifier">params</span> = <span class="ruby-identifier">make_params</span>

  (<span class="ruby-identifier">qs</span> <span class="ruby-operator">||</span> <span class="ruby-string">&#39;&#39;</span>).<span class="ruby-identifier">split</span>(<span class="ruby-identifier">d</span> <span class="ruby-operator">?</span> (<span class="ruby-constant">COMMON_SEP</span>[<span class="ruby-identifier">d</span>] <span class="ruby-operator">||</span> <span class="ruby-regexp">/[#{d}] */n</span>) <span class="ruby-operator">:</span> <span class="ruby-constant">DEFAULT_SEP</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span> = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&#39;=&#39;</span>, <span class="ruby-value">2</span>).<span class="ruby-identifier">map!</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">unescaper</span>)

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">cur</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>]
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">cur</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>
        <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">v</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] = [<span class="ruby-identifier">cur</span>, <span class="ruby-identifier">v</span>]
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">return</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">to_h</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
     <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Private Instance Methods</h3>
       </header>

    
      <div id="method-i-params_hash_has_key-3F" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">params_hash_has_key?</span><span
            class="method-args">(hash, key)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="params_hash_has_key-3F-source">
            <pre><span class="ruby-comment"># File lib/rack/query_parser.rb, line 146</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">params_hash_has_key?</span>(<span class="ruby-identifier">hash</span>, <span class="ruby-identifier">key</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">if</span> <span class="ruby-regexp">/\[\]/</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">key</span>)

  <span class="ruby-identifier">key</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/[\[\]]+/</span>).<span class="ruby-identifier">inject</span>(<span class="ruby-identifier">hash</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">h</span>, <span class="ruby-identifier">part</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">next</span> <span class="ruby-identifier">h</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">part</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;&#39;</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">params_hash_type?</span>(<span class="ruby-identifier">h</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">part</span>)
    <span class="ruby-identifier">h</span>[<span class="ruby-identifier">part</span>]
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-params_hash_type-3F" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">params_hash_type?</span><span
            class="method-args">(obj)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="params_hash_type-3F-source">
            <pre><span class="ruby-comment"># File lib/rack/query_parser.rb, line 142</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">params_hash_type?</span>(<span class="ruby-identifier">obj</span>)
  <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-ivar">@params_class</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-unescape" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">unescape</span><span
            class="method-args">(s)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="unescape-source">
            <pre><span class="ruby-comment"># File lib/rack/query_parser.rb, line 158</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">unescape</span>(<span class="ruby-identifier">s</span>)
  <span class="ruby-constant">Utils</span>.<span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">s</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>


Zerion Mini Shell 1.0