Class: Spree::Preferences::ScopedStore
- Inherits:
-
Object
- Object
- Spree::Preferences::ScopedStore
- Defined in:
- app/models/spree/preferences/scoped_store.rb
Instance Method Summary collapse
- #[]=(key, value) ⇒ Object
- #delete(key) ⇒ Object
- #fetch(key, &block) ⇒ Object
-
#initialize(prefix, suffix = nil) ⇒ ScopedStore
constructor
A new instance of ScopedStore.
- #store ⇒ Object
Constructor Details
#initialize(prefix, suffix = nil) ⇒ ScopedStore
Returns a new instance of ScopedStore.
3 4 5 6 |
# File 'app/models/spree/preferences/scoped_store.rb', line 3 def initialize(prefix, suffix = nil) @prefix = prefix @suffix = suffix end |
Instance Method Details
#[]=(key, value) ⇒ Object
16 17 18 |
# File 'app/models/spree/preferences/scoped_store.rb', line 16 def []=(key, value) store[key_for(key)] = value end |
#delete(key) ⇒ Object
20 21 22 |
# File 'app/models/spree/preferences/scoped_store.rb', line 20 def delete(key) store.delete(key_for(key)) end |
#fetch(key, &block) ⇒ Object
12 13 14 |
# File 'app/models/spree/preferences/scoped_store.rb', line 12 def fetch(key, &block) store.fetch(key_for(key), &block) end |
#store ⇒ Object
8 9 10 |
# File 'app/models/spree/preferences/scoped_store.rb', line 8 def store Spree::Preferences::Store.instance end |