Class: LogtoClient::SessionStorage

Inherits:
AbstractStorage show all
Defined in:
lib/logto/client/index_storage.rb

Overview

A storage class that stores data in Rails session.

Instance Method Summary collapse

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[getSessionKey(key)]
end

#remove(key) ⇒ Object



43
44
45
# File 'lib/logto/client/index_storage.rb', line 43

def remove(key)
  @session.delete(getSessionKey(key))
end

#set(key, value) ⇒ Object



39
40
41
# File 'lib/logto/client/index_storage.rb', line 39

def set(key, value)
  @session[getSessionKey(key)] = value
end