Class: Session
Instance Attribute Summary collapse
-
#cookie ⇒ Object
readonly
Returns the value of attribute cookie.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, val) ⇒ Object
-
#initialize(req) ⇒ Session
constructor
A new instance of Session.
- #store_session(res) ⇒ Object
Constructor Details
#initialize(req) ⇒ Session
Returns a new instance of Session.
4 5 6 7 |
# File 'lib/laris/controller/session.rb', line 4 def initialize(req) = req.['_laris_session'] @cookie = ? JSON.parse() : {} end |
Instance Attribute Details
#cookie ⇒ Object (readonly)
Returns the value of attribute cookie.
2 3 4 |
# File 'lib/laris/controller/session.rb', line 2 def @cookie end |
Instance Method Details
#[](key) ⇒ Object
9 10 11 |
# File 'lib/laris/controller/session.rb', line 9 def [](key) [key] end |
#[]=(key, val) ⇒ Object
13 14 15 |
# File 'lib/laris/controller/session.rb', line 13 def []=(key, val) [key] = val end |
#store_session(res) ⇒ Object
17 18 19 20 |
# File 'lib/laris/controller/session.rb', line 17 def store_session(res) = { path: '/', value: .to_json } res.('_laris_session', ) end |