Class: ShopifyApp::InMemorySessionStore
- Inherits:
-
Object
- Object
- ShopifyApp::InMemorySessionStore
show all
- Defined in:
- lib/shopify_app/session/in_memory_session_store.rb
Overview
rubocop:disable Style/ClassVars Class var repo is needed here in order to share data between the 2 child classes.
Class Method Summary
collapse
Class Method Details
.clear ⇒ Object
17
18
19
|
# File 'lib/shopify_app/session/in_memory_session_store.rb', line 17
def self.clear
@@repo = nil
end
|
.repo ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/shopify_app/session/in_memory_session_store.rb', line 21
def self.repo
if Rails.env.production?
raise ::ShopifyApp::EnvironmentError, "Cannot use InMemorySessionStore in a Production environment. \
Please initialize ShopifyApp with a model that can store and retrieve sessions"
end
@@repo ||= {}
end
|
.retrieve(id) ⇒ Object
7
8
9
|
# File 'lib/shopify_app/session/in_memory_session_store.rb', line 7
def self.retrieve(id)
repo[id]
end
|
.store(session, *_args) ⇒ Object
11
12
13
14
15
|
# File 'lib/shopify_app/session/in_memory_session_store.rb', line 11
def self.store(session, *_args)
id = SecureRandom.uuid
repo[id] = session
id
end
|