Class: LogtoClient::SessionStorage
- Inherits:
-
AbstractStorage
- Object
- AbstractStorage
- LogtoClient::SessionStorage
- Defined in:
- lib/logto/client/index_storage.rb
Overview
A storage class that stores data in Rails session.
Instance Method Summary collapse
- #get(key) ⇒ Object
-
#initialize(session, app_id: nil) ⇒ SessionStorage
constructor
A new instance of SessionStorage.
- #remove(key) ⇒ Object
- #set(key, value) ⇒ Object
Constructor Details
#initialize(session, app_id: nil) ⇒ SessionStorage
Returns a new instance of SessionStorage.
30 31 32 33 |
# File 'lib/logto/client/index_storage.rb', line 30 def initialize(session, app_id: nil) @session = session @app_id = app_id end |
Instance Method Details
#get(key) ⇒ Object
35 36 37 |
# File 'lib/logto/client/index_storage.rb', line 35 def get(key) @session[get_session_key(key)] end |
#remove(key) ⇒ Object
43 44 45 |
# File 'lib/logto/client/index_storage.rb', line 43 def remove(key) @session.delete(get_session_key(key)) end |
#set(key, value) ⇒ Object
39 40 41 |
# File 'lib/logto/client/index_storage.rb', line 39 def set(key, value) @session[get_session_key(key)] = value end |