Sha256: f89788eba93eff6464eac5a4da1e7283cb44e5cc89ab73adc87b25b3295f44ec

Contents?: true

Size: 976 Bytes

Versions: 5

Compression:

Stored size: 976 Bytes

Contents

module Mack
  
  # A holder for the session information. This objects gets stored using the Cachetastic system.
  # For more information about how Cachetastic works see the RDoc for that gem.
  # The session cookie name defaults to: _mack_session_id but can be changed using the application_configuration
  # system like such:
  #   mack::session_id: _my_cool_app_sess_id
  class Session
    
    attr_reader :id # The id of the session.
    
    def initialize(id)
      @id = id
      @sess_hash = {}
    end
    
    # Finds what you're looking for in the session, if it exists.
    # If what you're looking for doesn't exist, it returns nil.
    def [](key)
      sess_hash[key.to_sym]
    end
    
    # Sets a value into the session.
    def []=(key, value)
      sess_hash[key.to_sym] = value
    end
    
    # Clears out the session.
    def reset!
      @sess_hash = {}
    end
    
    private
    attr_reader :sess_hash # :nodoc:
    
  end # Session
  
end # Mack

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mack-0.6.0 lib/controller/session.rb
mack-0.6.0.1 lib/controller/session.rb
mack-0.6.1.1 lib/mack/controller/session.rb
mack-0.6.1.2 lib/mack/controller/session.rb
mack-0.6.1 lib/mack/controller/session.rb