Class: Mack::Session
- Inherits:
-
Object
- Object
- Mack::Session
- Defined in:
- lib/sea_level/session.rb
Overview
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
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
The id of the session.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Finds what you’re looking for in the session, if it exists.
-
#[]=(key, value) ⇒ Object
Sets a value into the session.
-
#initialize(id) ⇒ Session
constructor
A new instance of Session.
Constructor Details
#initialize(id) ⇒ Session
Returns a new instance of Session.
12 13 14 15 |
# File 'lib/sea_level/session.rb', line 12 def initialize(id) @id = id @sess_hash = {} end |
Instance Attribute Details
#id ⇒ Object (readonly)
The id of the session.
10 11 12 |
# File 'lib/sea_level/session.rb', line 10 def id @id end |
Instance Method Details
#[](key) ⇒ Object
Finds what you’re looking for in the session, if it exists. If what you’re looking for doesn’t exist, it returns nil.
19 20 21 |
# File 'lib/sea_level/session.rb', line 19 def [](key) sess_hash[key.to_sym] end |
#[]=(key, value) ⇒ Object
Sets a value into the session.
24 25 26 |
# File 'lib/sea_level/session.rb', line 24 def []=(key, value) sess_hash[key.to_sym] = value end |