### Home Classes Methods

### In Files

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

### Parent

Object

### Methods

- ::find
- ::new
- ::set
- ::set_options
- #[]
- #[]=
- #clear
- #delete
- #destroy
- #each
- #empty?
- #exists?
- #fetch
- #has_key?
- #id
- #include?
- #inspect
- #key?
- #keys
- #loaded?
- #merge!
- #options
- #replace
- #store
- #to_hash
- #update
- #values

### Included Modules

- Enumerable

### 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::MultipartPartLimitError
- 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::JSON
- Rack::Session::Cookie::Base64::Marshal
- Rack::Session::Cookie::Base64::ZipJSON
- Rack::Session::Cookie::Identity
- Rack::Session::Memcache
- Rack::Session::Pool
- Rack::ShowExceptions
- Rack::ShowStatus
- Rack::Static
- Rack::TempfileReaper
- Rack::URLMap
- Rack::Utils
- Rack::Utils::Context
- Rack::Utils::HeaderHash
- Rack::Utils::InvalidParameterError
- Rack::Utils::KeySpaceConstrainedParams
- Rack::Utils::Multipart
- Rack::Utils::OkJson
- Rack::Utils::OkJson::Error
- Rack::Utils::OkJson::Utf8Error
- Rack::Utils::ParameterTypeError
- FCGI
- FCGI::Stream
- WEBrick
- WEBrick::HTTPResponse
- Object

No matching classes.

# Rack::Session::Abstract::SessionHash

SessionHash is responsible to lazily load the session from store.

### Attributes

id[W]

### Public Class Methods

find(env) click to toggle source

    # File lib/rack/session/abstract/id.rb, line 27
    def self.find(env)
      env[ENV_SESSION_KEY]
    end

new(store, env) click to toggle source

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

set(env, session) click to toggle source

    # File lib/rack/session/abstract/id.rb, line 31
    def self.set(env, session)
      env[ENV_SESSION_KEY] = session
    end

set_options(env, options) click to toggle source

    # File lib/rack/session/abstract/id.rb, line 35
    def self.set_options(env, options)
      env[ENV_SESSION_OPTIONS_KEY] = options.dup
    end

### Public Instance Methods

[](key) click to toggle source

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

Also aliased as: fetch
[]=(key, value) click to toggle source

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

Also aliased as: store
clear() click to toggle source

    # File lib/rack/session/abstract/id.rb, line 78
    def clear
      load_for_write!
      @data.clear
    end

delete(key) click to toggle source

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

destroy() click to toggle source

    # File lib/rack/session/abstract/id.rb, line 83
    def destroy
      clear
      @id = @store.send(:destroy_session, @env, id, options)
    end

each(&block) click to toggle source

    # File lib/rack/session/abstract/id.rb, line 54
    def each(&block)
      load_for_read!
      @data.each(&block)
    end

empty?() click to toggle source

    # File lib/rack/session/abstract/id.rb, line 127
    def empty?
      load_for_read!
      @data.empty?
    end

exists?() click to toggle source

    # File lib/rack/session/abstract/id.rb, line 117
    def exists?
      return @exists if instance_variable_defined?(:@exists)
      @data = {}
      @exists = @store.send(:session_exists?, @env)
    end

fetch(key) click to toggle source
Alias for: []
has_key?(key) click to toggle source

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

Also aliased as: key?, include?
id() click to toggle source

    # File lib/rack/session/abstract/id.rb, line 45
    def id
      return @id if @loaded or instance_variable_defined?(:@id)
      @id = @store.send(:extract_session_id, @env)
    end

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

    # File lib/rack/session/abstract/id.rb, line 109
    def inspect
      if loaded?
        @data.inspect
      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?
keys() click to toggle source

    # File lib/rack/session/abstract/id.rb, line 132
    def keys
      @data.keys
    end

loaded?() click to toggle source

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

merge!(hash) click to toggle source
Alias for: update
options() click to toggle source

    # File lib/rack/session/abstract/id.rb, line 50
    def options
      @env[ENV_SESSION_OPTIONS_KEY]
    end

replace(hash) click to toggle source

    # File lib/rack/session/abstract/id.rb, line 99
    def replace(hash)
      load_for_write!
      @data.replace(stringify_keys(hash))
    end

store(key, value) click to toggle source
Alias for: []=
to_hash() click to toggle source

    # File lib/rack/session/abstract/id.rb, line 88
    def to_hash
      load_for_read!
      @data.dup
    end

update(hash) click to toggle source

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

Also aliased as: merge!
values() click to toggle source

    # File lib/rack/session/abstract/id.rb, line 136
    def values
      @data.values
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.