Class: Session
- Inherits:
-
Object
- Object
- Session
- Defined in:
- lib/session.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, val) ⇒ Object
-
#initialize(req) ⇒ Session
constructor
A new instance of Session.
- #store_session(res) ⇒ Object
Constructor Details
permalink #initialize(req) ⇒ Session
Returns a new instance of Session.
4 5 6 7 8 9 10 |
# File 'lib/session.rb', line 4 def initialize(req) if req.['_'] @cookie = JSON.parse(req.['_bezel']) else @cookie = {} end end |
Instance Method Details
permalink #[](key) ⇒ Object
[View source]
12 13 14 |
# File 'lib/session.rb', line 12 def [](key) @cookie[key] end |
permalink #[]=(key, val) ⇒ Object
[View source]
16 17 18 |
# File 'lib/session.rb', line 16 def []=(key, val) @cookie[key] = val end |
permalink #store_session(res) ⇒ Object
[View source]
20 21 22 23 |
# File 'lib/session.rb', line 20 def store_session(res) = @cookie.to_json res.('_bezel', value: , path: '/' ) end |