Class: Spree::Preferences::ScopedStore

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

Instance Method Summary collapse

Constructor Details

#initialize(prefix, suffix = nil) ⇒ ScopedStore

Returns a new instance of ScopedStore.



5
6
7
8
# File 'lib/spree/preferences/scoped_store.rb', line 5

def initialize(prefix, suffix = nil)
  @prefix = prefix
  @suffix = suffix
end

Instance Method Details

#[]=(key, value) ⇒ Object



18
19
20
# File 'lib/spree/preferences/scoped_store.rb', line 18

def []=(key, value)
  store[key_for(key)] = value
end

#delete(key) ⇒ Object



22
23
24
# File 'lib/spree/preferences/scoped_store.rb', line 22

def delete(key)
  store.delete(key_for(key))
end

#fetch(key, &block) ⇒ Object



14
15
16
# File 'lib/spree/preferences/scoped_store.rb', line 14

def fetch(key, &block)
  store.fetch(key_for(key), &block)
end

#storeObject



10
11
12
# File 'lib/spree/preferences/scoped_store.rb', line 10

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