Class: FlowChat::Session::RailsSessionStore
- Inherits:
-
Object
- Object
- FlowChat::Session::RailsSessionStore
- Defined in:
- lib/flow_chat/session/rails_session_store.rb
Instance Method Summary collapse
- #delete(key) ⇒ Object
- #destroy ⇒ Object
- #get(key) ⇒ Object
-
#initialize(context) ⇒ RailsSessionStore
constructor
A new instance of RailsSessionStore.
- #set(key, value) ⇒ Object
Constructor Details
#initialize(context) ⇒ RailsSessionStore
Returns a new instance of RailsSessionStore.
4 5 6 7 8 |
# File 'lib/flow_chat/session/rails_session_store.rb', line 4 def initialize(context) @session_id = context["session.id"] @session_store = context.controller.session @session_data = (session_store[session_id] || {}).with_indifferent_access end |
Instance Method Details
#delete(key) ⇒ Object
20 21 22 |
# File 'lib/flow_chat/session/rails_session_store.rb', line 20 def delete(key) set key, nil end |
#destroy ⇒ Object
24 25 26 |
# File 'lib/flow_chat/session/rails_session_store.rb', line 24 def destroy session_store[session_id] = nil end |
#get(key) ⇒ Object
10 11 12 |
# File 'lib/flow_chat/session/rails_session_store.rb', line 10 def get(key) session_data[key] end |
#set(key, value) ⇒ Object
14 15 16 17 18 |
# File 'lib/flow_chat/session/rails_session_store.rb', line 14 def set(key, value) session_data[key] = value session_store[session_id] = session_data value end |