Module: Moneta::OptionSupport Private
- Included in:
- Defaults
- Defined in:
- lib/moneta/mixins.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#expires(expires) ⇒ OptionMerger
Return Moneta store with default expiration time.
-
#prefix(prefix) ⇒ OptionMerger
Return Moneta store with default prefix option.
-
#raw ⇒ OptionMerger
Return Moneta store with default option raw: true.
-
#with(options = nil, &block) ⇒ Moneta store
Return Moneta store with default options or additional proxies.
Instance Method Details
#expires(expires) ⇒ OptionMerger
Return Moneta store with default expiration time
47 48 49 |
# File 'lib/moneta/mixins.rb', line 47 def expires(expires) with(expires: expires, only: [:store, :create, :increment]) end |
#prefix(prefix) ⇒ OptionMerger
Return Moneta store with default prefix option
38 39 40 |
# File 'lib/moneta/mixins.rb', line 38 def prefix(prefix) with(prefix: prefix, except: :clear) end |
#raw ⇒ OptionMerger
Return Moneta store with default option raw: true
24 25 26 27 28 29 30 31 |
# File 'lib/moneta/mixins.rb', line 24 def raw @raw_store ||= begin store = with(raw: true, only: [:load, :store, :create, :delete]) store.instance_variable_set(:@raw_store, store) store end end |
#with(options = nil, &block) ⇒ Moneta store
Return Moneta store with default options or additional proxies
10 11 12 13 14 15 16 17 18 |
# File 'lib/moneta/mixins.rb', line 10 def with( = nil, &block) adapter = self if block builder = Builder.new(&block) builder.adapter(adapter) adapter = builder.build.last end ? OptionMerger.new(adapter, ) : adapter end |