관리-도구
편집 파일: SessionHash.html
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>class Rack::Session::Abstract::SessionHash - rack-2.2.10 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> <div id="includes-section" class="nav-section"> <h3>Included Modules</h3> <ul class="link-list"> <li><span class="include">Enumerable</span> </ul> </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-find">::find</a> <li ><a href="#method-c-new">::new</a> <li ><a href="#method-c-set">::set</a> <li ><a href="#method-c-set_options">::set_options</a> <li ><a href="#method-i-5B-5D">#[]</a> <li ><a href="#method-i-5B-5D-3D">#[]=</a> <li ><a href="#method-i-clear">#clear</a> <li ><a href="#method-i-delete">#delete</a> <li ><a href="#method-i-destroy">#destroy</a> <li ><a href="#method-i-dig">#dig</a> <li ><a href="#method-i-each">#each</a> <li ><a href="#method-i-empty-3F">#empty?</a> <li ><a href="#method-i-exists-3F">#exists?</a> <li ><a href="#method-i-fetch">#fetch</a> <li ><a href="#method-i-has_key-3F">#has_key?</a> <li ><a href="#method-i-id">#id</a> <li ><a href="#method-i-include-3F">#include?</a> <li ><a href="#method-i-inspect">#inspect</a> <li ><a href="#method-i-key-3F">#key?</a> <li ><a href="#method-i-keys">#keys</a> <li ><a href="#method-i-load-21">#load!</a> <li ><a href="#method-i-load_for_read-21">#load_for_read!</a> <li ><a href="#method-i-load_for_write-21">#load_for_write!</a> <li ><a href="#method-i-loaded-3F">#loaded?</a> <li ><a href="#method-i-merge-21">#merge!</a> <li ><a href="#method-i-options">#options</a> <li ><a href="#method-i-replace">#replace</a> <li ><a href="#method-i-store">#store</a> <li ><a href="#method-i-stringify_keys">#stringify_keys</a> <li ><a href="#method-i-to_hash">#to_hash</a> <li ><a href="#method-i-update">#update</a> <li ><a href="#method-i-values">#values</a> </ul> </div> </div> </nav> <main role="main" aria-labelledby="class-Rack::Session::Abstract::SessionHash"> <h1 id="class-Rack::Session::Abstract::SessionHash" class="class"> class Rack::Session::Abstract::SessionHash </h1> <section class="description"> <p><a href="SessionHash.html"><code>SessionHash</code></a> is responsible to lazily load the session from store.</p> </section> <section id="5Buntitled-5D" class="documentation-section"> <section class="constants-list"> <header> <h3>Constants</h3> </header> <dl> <dt id="Unspecified">Unspecified <dd> </dl> </section> <section class="attribute-method-details" class="method-section"> <header> <h3>Attributes</h3> </header> <div id="attribute-i-id" class="method-detail"> <div class="method-heading attribute-method-heading"> <span class="method-name">id</span><span class="attribute-access-type">[W]</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-find" class="method-detail "> <div class="method-heading"> <span class="method-name">find</span><span class="method-args">(req)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="find-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 50</span> <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">find</span>(<span class="ruby-identifier">req</span>) <span class="ruby-identifier">req</span>.<span class="ruby-identifier">get_header</span> <span class="ruby-constant">RACK_SESSION</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">(store, req)</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/session/abstract/id.rb, line 62</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">req</span>) <span class="ruby-ivar">@store</span> = <span class="ruby-identifier">store</span> <span class="ruby-ivar">@req</span> = <span class="ruby-identifier">req</span> <span class="ruby-ivar">@loaded</span> = <span class="ruby-keyword">false</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-c-set" class="method-detail "> <div class="method-heading"> <span class="method-name">set</span><span class="method-args">(req, session)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="set-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 54</span> <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">set</span>(<span class="ruby-identifier">req</span>, <span class="ruby-identifier">session</span>) <span class="ruby-identifier">req</span>.<span class="ruby-identifier">set_header</span> <span class="ruby-constant">RACK_SESSION</span>, <span class="ruby-identifier">session</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-c-set_options" class="method-detail "> <div class="method-heading"> <span class="method-name">set_options</span><span class="method-args">(req, options)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="set_options-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 58</span> <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">set_options</span>(<span class="ruby-identifier">req</span>, <span class="ruby-identifier">options</span>) <span class="ruby-identifier">req</span>.<span class="ruby-identifier">set_header</span> <span class="ruby-constant">RACK_SESSION_OPTIONS</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">dup</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-5B-5D" class="method-detail "> <div class="method-heading"> <span class="method-name">[]</span><span class="method-args">(key)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="5B-5D-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 82</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">[]</span>(<span class="ruby-identifier">key</span>) <span class="ruby-identifier">load_for_read!</span> <span class="ruby-ivar">@data</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-5B-5D-3D" class="method-detail "> <div class="method-heading"> <span class="method-name">[]=</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="5B-5D-3D-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 108</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>) <span class="ruby-identifier">load_for_write!</span> <span class="ruby-ivar">@data</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">value</span> <span class="ruby-keyword">end</span></pre> </div> </div> <div class="aliases"> Also aliased as: <a href="SessionHash.html#method-i-store">store</a> </div> </div> <div id="method-i-clear" class="method-detail "> <div class="method-heading"> <span class="method-name">clear</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="clear-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 114</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">clear</span> <span class="ruby-identifier">load_for_write!</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">clear</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-delete" class="method-detail "> <div class="method-heading"> <span class="method-name">delete</span><span class="method-args">(key)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="delete-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 140</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete</span>(<span class="ruby-identifier">key</span>) <span class="ruby-identifier">load_for_write!</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-destroy" class="method-detail "> <div class="method-heading"> <span class="method-name">destroy</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="destroy-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 119</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">destroy</span> <span class="ruby-identifier">clear</span> <span class="ruby-ivar">@id</span> = <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">send</span>(<span class="ruby-value">:delete_session</span>, <span class="ruby-ivar">@req</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">options</span>) <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-dig" class="method-detail "> <div class="method-heading"> <span class="method-name">dig</span><span class="method-args">(key, *keys)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="dig-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 87</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">dig</span>(<span class="ruby-identifier">key</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">keys</span>) <span class="ruby-identifier">load_for_read!</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">dig</span>(<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">keys</span>) <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-each" class="method-detail "> <div class="method-heading"> <span class="method-name">each</span><span class="method-args">(&block)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="each-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 77</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">each</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>) <span class="ruby-identifier">load_for_read!</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">each</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-empty-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">empty?</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="empty-3F-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 163</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">empty?</span> <span class="ruby-identifier">load_for_read!</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-exists-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">exists?</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="exists-3F-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 153</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">exists?</span> <span class="ruby-keyword">return</span> <span class="ruby-ivar">@exists</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">instance_variable_defined?</span>(<span class="ruby-value">:@exists</span>) <span class="ruby-ivar">@data</span> = {} <span class="ruby-ivar">@exists</span> = <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">send</span>(<span class="ruby-value">:session_exists?</span>, <span class="ruby-ivar">@req</span>) <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-fetch" class="method-detail "> <div class="method-heading"> <span class="method-name">fetch</span><span class="method-args">(key, default = Unspecified, &block)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="fetch-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 92</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">fetch</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">default</span> = <span class="ruby-constant">Unspecified</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>) <span class="ruby-identifier">load_for_read!</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">default</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Unspecified</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword">else</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">default</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-has_key-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">has_key?</span><span class="method-args">(key)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="has_key-3F-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 101</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">has_key?</span>(<span class="ruby-identifier">key</span>) <span class="ruby-identifier">load_for_read!</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword">end</span></pre> </div> </div> <div class="aliases"> Also aliased as: <a href="SessionHash.html#method-i-key-3F">key?</a>, <a href="SessionHash.html#method-i-include-3F">include?</a> </div> </div> <div id="method-i-id" class="method-detail "> <div class="method-heading"> <span class="method-name">id</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="id-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 68</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">id</span> <span class="ruby-keyword">return</span> <span class="ruby-ivar">@id</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@loaded</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">instance_variable_defined?</span>(<span class="ruby-value">:@id</span>) <span class="ruby-ivar">@id</span> = <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">send</span>(<span class="ruby-value">:extract_session_id</span>, <span class="ruby-ivar">@req</span>) <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-include-3F" class="method-detail method-alias"> <div class="method-heading"> <span class="method-name">include?</span><span class="method-args">(key)</span> </div> <div class="method-description"> </div> <div class="aliases"> Alias for: <a href="SessionHash.html#method-i-has_key-3F">has_key?</a> </div> </div> <div id="method-i-inspect" class="method-detail "> <div class="method-heading"> <span class="method-name">inspect</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="inspect-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 145</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">inspect</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">loaded?</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">inspect</span> <span class="ruby-keyword">else</span> <span class="ruby-node">"#<#{self.class}:0x#{self.object_id.to_s(16)} not yet loaded>"</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-key-3F" class="method-detail method-alias"> <div class="method-heading"> <span class="method-name">key?</span><span class="method-args">(key)</span> </div> <div class="method-description"> </div> <div class="aliases"> Alias for: <a href="SessionHash.html#method-i-has_key-3F">has_key?</a> </div> </div> <div id="method-i-keys" class="method-detail "> <div class="method-heading"> <span class="method-name">keys</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="keys-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 168</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">keys</span> <span class="ruby-identifier">load_for_read!</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">keys</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-loaded-3F" class="method-detail "> <div class="method-heading"> <span class="method-name">loaded?</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="loaded-3F-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 159</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">loaded?</span> <span class="ruby-ivar">@loaded</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-merge-21" class="method-detail method-alias"> <div class="method-heading"> <span class="method-name">merge!</span><span class="method-args">(hash)</span> </div> <div class="method-description"> </div> <div class="aliases"> Alias for: <a href="SessionHash.html#method-i-update">update</a> </div> </div> <div id="method-i-options" class="method-detail "> <div class="method-heading"> <span class="method-name">options</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="options-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 73</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">options</span> <span class="ruby-ivar">@req</span>.<span class="ruby-identifier">session_options</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-replace" class="method-detail "> <div class="method-heading"> <span class="method-name">replace</span><span class="method-args">(hash)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="replace-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 135</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">replace</span>(<span class="ruby-identifier">hash</span>) <span class="ruby-identifier">load_for_write!</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-identifier">stringify_keys</span>(<span class="ruby-identifier">hash</span>)) <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-store" class="method-detail method-alias"> <div class="method-heading"> <span class="method-name">store</span><span class="method-args">(key, value)</span> </div> <div class="method-description"> </div> <div class="aliases"> Alias for: <a href="SessionHash.html#method-i-5B-5D-3D">[]=</a> </div> </div> <div id="method-i-to_hash" class="method-detail "> <div class="method-heading"> <span class="method-name">to_hash</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="to_hash-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 124</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_hash</span> <span class="ruby-identifier">load_for_read!</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">dup</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-update" class="method-detail "> <div class="method-heading"> <span class="method-name">update</span><span class="method-args">(hash)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="update-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 129</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">update</span>(<span class="ruby-identifier">hash</span>) <span class="ruby-identifier">load_for_write!</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">stringify_keys</span>(<span class="ruby-identifier">hash</span>)) <span class="ruby-keyword">end</span></pre> </div> </div> <div class="aliases"> Also aliased as: <a href="SessionHash.html#method-i-merge-21">merge!</a> </div> </div> <div id="method-i-values" class="method-detail "> <div class="method-heading"> <span class="method-name">values</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="values-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 173</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">values</span> <span class="ruby-identifier">load_for_read!</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">values</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-load-21" class="method-detail "> <div class="method-heading"> <span class="method-name">load!</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="load-21-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 188</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">load!</span> <span class="ruby-ivar">@id</span>, <span class="ruby-identifier">session</span> = <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">send</span>(<span class="ruby-value">:load_session</span>, <span class="ruby-ivar">@req</span>) <span class="ruby-ivar">@data</span> = <span class="ruby-identifier">stringify_keys</span>(<span class="ruby-identifier">session</span>) <span class="ruby-ivar">@loaded</span> = <span class="ruby-keyword">true</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-load_for_read-21" class="method-detail "> <div class="method-heading"> <span class="method-name">load_for_read!</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="load_for_read-21-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 180</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">load_for_read!</span> <span class="ruby-identifier">load!</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">loaded?</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">exists?</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-load_for_write-21" class="method-detail "> <div class="method-heading"> <span class="method-name">load_for_write!</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="load_for_write-21-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 184</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">load_for_write!</span> <span class="ruby-identifier">load!</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">loaded?</span> <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div id="method-i-stringify_keys" class="method-detail "> <div class="method-heading"> <span class="method-name">stringify_keys</span><span class="method-args">(other)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="stringify_keys-source"> <pre><span class="ruby-comment"># File lib/rack/session/abstract/id.rb, line 194</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">stringify_keys</span>(<span class="ruby-identifier">other</span>) <span class="ruby-comment"># Use transform_keys after dropping Ruby 2.4 support</span> <span class="ruby-identifier">hash</span> = {} <span class="ruby-identifier">other</span>.<span class="ruby-identifier">to_hash</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">value</span> <span class="ruby-keyword">end</span> <span class="ruby-identifier">hash</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>