Class: Omniauth::Rails::AuthenticationDataStore

Inherits:
Object
  • Object
show all
Defined in:
app/models/omniauth/rails/authentication_data_store.rb

Constant Summary collapse

SCOPE =
"OmniauthRailsAuthData"

Instance Method Summary collapse

Constructor Details

#initialize(session) ⇒ AuthenticationDataStore

Returns a new instance of AuthenticationDataStore.



7
8
9
10
# File 'app/models/omniauth/rails/authentication_data_store.rb', line 7

def initialize(session)
  @session = session
  freeze
end

Instance Method Details

#get(key) ⇒ Object



12
13
14
15
# File 'app/models/omniauth/rails/authentication_data_store.rb', line 12

def get(key)
  return nil if session[SCOPE].nil?
  session[SCOPE][key]
end

#resetObject



22
23
24
# File 'app/models/omniauth/rails/authentication_data_store.rb', line 22

def reset
  session[SCOPE] = {}
end

#set(key, value) ⇒ Object



17
18
19
20
# File 'app/models/omniauth/rails/authentication_data_store.rb', line 17

def set(key, value)
  session[SCOPE] ||= {}
  session[SCOPE][key] = value
end