Class: Rack::Session::Abstract::SessionHash

### Home Classes Methods

### In Files

- lib/rack/session/abstract/id.rb

### Parent

Hash

### Methods

- ::new
- #[]
- #[]=
- #clear
- #delete
- #empty?
- #exists?
- #has_key?
- #include?
- #inspect
- #key?
- #loaded?
- #merge!
- #to_hash
- #update

### Files

- KNOWN-ISSUES

### Class/Module Index

Quicksearch

- Rack
- Rack::Auth
- Rack::Auth::AbstractHandler
- Rack::Auth::AbstractRequest
- Rack::Auth::Basic
- Rack::Auth::Basic::Request
- Rack::Auth::Digest
- Rack::Auth::Digest::MD5
- Rack::Auth::Digest::Nonce
- Rack::Auth::Digest::Params
- Rack::Auth::Digest::Request
- Rack::BodyProxy
- Rack::Builder
- Rack::Cascade
- Rack::Chunked
- Rack::Chunked::Body
- Rack::CommonLogger
- Rack::ConditionalGet
- Rack::Config
- Rack::ContentLength
- Rack::ContentType
- Rack::Deflater
- Rack::Deflater::DeflateStream
- Rack::Deflater::GzipStream
- Rack::Directory
- Rack::ETag
- Rack::File
- Rack::ForwardRequest
- Rack::Handler
- Rack::Handler::CGI
- Rack::Handler::EventedMongrel
- Rack::Handler::FastCGI
- Rack::Handler::LSWS
- Rack::Handler::Mongrel
- Rack::Handler::SCGI
- Rack::Handler::SwiftipliedMongrel
- Rack::Handler::Thin
- Rack::Handler::WEBrick
- Rack::Head
- Rack::Lint
- Rack::Lobster
- Rack::Lock
- Rack::Logger
- Rack::MethodOverride
- Rack::Mime
- Rack::MockRequest
- Rack::MockRequest::FatalWarner
- Rack::MockRequest::FatalWarning
- Rack::MockResponse
- Rack::Multipart
- Rack::Multipart::Generator
- Rack::Multipart::Parser
- Rack::Multipart::UploadedFile
- Rack::NullLogger
- Rack::Recursive
- Rack::Reloader
- Rack::Reloader::Stat
- Rack::Request
- Rack::Response
- Rack::Response::Helpers
- Rack::RewindableInput
- Rack::RewindableInput::Tempfile
- Rack::Runtime
- Rack::Sendfile
- Rack::Server
- Rack::Server::Options
- Rack::Session
- Rack::Session::Abstract
- Rack::Session::Abstract::ID
- Rack::Session::Abstract::SessionHash
- Rack::Session::Cookie
- Rack::Session::Cookie::Base64
- Rack::Session::Cookie::Base64::Marshal
- Rack::Session::Cookie::Identity
- Rack::Session::Cookie::Reverse
- Rack::Session::Memcache
- Rack::Session::Pool
- Rack::ShowExceptions
- Rack::ShowStatus
- Rack::Static
- Rack::URLMap
- Rack::Utils
- Rack::Utils::Context
- Rack::Utils::HeaderHash
- Rack::Utils::KeySpaceConstrainedParams
- Rack::Utils::Multipart
- FCGI
- FCGI::Stream
- Object

No matching classes.

# Rack::Session::Abstract::SessionHash

SessionHash is responsible to lazily load the session from store.

### Public Class Methods

new(by, env) click to toggle source

    # File lib/rack/session/abstract/id.rb, line 51
    def initialize(by, env)
      super()
      @by = by
      @env = env
      @loaded = false
    end

### Public Instance Methods

[](key) click to toggle source

    # File lib/rack/session/abstract/id.rb, line 58
    def [](key)
      load_for_read!
      super(key.to_s)
    end

[]=(key, value) click to toggle source

    # File lib/rack/session/abstract/id.rb, line 70
    def []=(key, value)
      load_for_write!
      super(key.to_s, value)
    end

clear() click to toggle source

    # File lib/rack/session/abstract/id.rb, line 75
    def clear
      load_for_write!
      super
    end

delete(key) click to toggle source

    # File lib/rack/session/abstract/id.rb, line 92
    def delete(key)
      load_for_write!
      super(key.to_s)
    end

empty?() click to toggle source

    # File lib/rack/session/abstract/id.rb, line 114
    def empty?
      load_for_read!
      super
    end

exists?() click to toggle source

    # File lib/rack/session/abstract/id.rb, line 105
    def exists?
      return @exists if instance_variable_defined?(:@exists)
      @exists = @by.send(:session_exists?, @env)
    end

has_key?(key) click to toggle source

    # File lib/rack/session/abstract/id.rb, line 63
    def has_key?(key)
      load_for_read!
      super(key.to_s)
    end

Also aliased as: key?, include?
include?(key) click to toggle source
Alias for: has_key?
inspect() click to toggle source

    # File lib/rack/session/abstract/id.rb, line 97
    def inspect
      if loaded?
        super
      else
        "#<#{self.class}:0x#{self.object_id.to_s(16)} not yet loaded>"
      end
    end

key?(key) click to toggle source
Alias for: has_key?
loaded?() click to toggle source

    # File lib/rack/session/abstract/id.rb, line 110
    def loaded?
      @loaded
    end

merge!(hash) click to toggle source

    # File lib/rack/session/abstract/id.rb, line 119
    def merge!(hash)
      load_for_write!
      super
    end

to_hash() click to toggle source

    # File lib/rack/session/abstract/id.rb, line 80
    def to_hash
      load_for_read!
      h = {}.replace(self)
      h.delete_if { |k,v| v.nil? }
      h
    end

update(hash) click to toggle source

    # File lib/rack/session/abstract/id.rb, line 87
    def update(hash)
      load_for_write!
      super(stringify_keys(hash))
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.