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

Instance Method Details

#expires(expires) ⇒ OptionMerger

Return Moneta store with default expiration time

Parameters:

  • expires (Integer)

    Default expiration time

Returns:



40
41
42
# File 'lib/moneta/mixins.rb', line 40

def expires(expires)
  with(:expires => expires, :only => [:store, :increment])
end

#prefix(prefix) ⇒ OptionMerger

Return Moneta store with default prefix option

Parameters:

  • prefix (String)

    Key prefix

Returns:



31
32
33
# File 'lib/moneta/mixins.rb', line 31

def prefix(prefix)
  with(:prefix => prefix, :except => :clear)
end

#rawOptionMerger

Return Moneta store with default option :raw => true

Returns:



17
18
19
20
21
22
23
24
# File 'lib/moneta/mixins.rb', line 17

def raw
  @raw_store ||=
    begin
      store = with(:raw => true, :only => [:load, :store, :delete])
      store.instance_variable_set(:@raw_store, store)
      store
    end
end

#with(options) ⇒ OptionMerger

Return Moneta store with default options

Parameters:

  • options (Hash)

    Options to merge

Returns:



9
10
11
# File 'lib/moneta/mixins.rb', line 9

def with(options)
  OptionMerger.new(self, options)
end