Class: Stale::Configuration

Inherits:
Object
  • Object
show all
Includes:
Parameters
Defined in:
lib/stale/configuration.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :expiration_time => 1.day,
  :key_prefix => 'stale:',
  :key_separator => ':',
  :model_key_separator => ':',
  :dependency_key_suffix => ':dependencies'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Parameters

#define_named_parameter, #key_for_parameter, #key_for_parameters, #named_parameters

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



16
17
18
19
# File 'lib/stale/configuration.rb', line 16

def initialize
  @options = DEFAULT_OPTIONS.clone
  @interface = Interface
end

Instance Attribute Details

#cacheObject

Returns the value of attribute cache.



13
14
15
# File 'lib/stale/configuration.rb', line 13

def cache
  @cache
end

#interfaceObject

Returns the value of attribute interface.



13
14
15
# File 'lib/stale/configuration.rb', line 13

def interface
  @interface
end

#optionsObject (readonly)

Returns the value of attribute options.



14
15
16
# File 'lib/stale/configuration.rb', line 14

def options
  @options
end

Instance Method Details

#[](key) ⇒ Object



21
22
23
# File 'lib/stale/configuration.rb', line 21

def [](key)
  options[key]
end

#[]=(key, value) ⇒ Object



25
26
27
# File 'lib/stale/configuration.rb', line 25

def []=(key, value)
  options[key] = value
end