Class: Spree::Preferences::ScopedStore

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/preferences/scoped_store.rb

Instance Method Summary collapse

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

#storeObject



8
9
10
# File 'app/models/spree/preferences/scoped_store.rb', line 8

def store
  Spree::Preferences::Store.instance
end