Class: Exchange::Cache::Configuration

Inherits:
Exchange::Configurable show all
Defined in:
lib/exchange/cache/configuration.rb

Overview

A Class that handles caching configuration options

Author:

  • Beat Richartz

Since:

  • 0.9

Version:

  • 0.9

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Exchange::Configurable

#reset, #subclass_with_constantize

Instance Attribute Details

#expireObject

Additional properties which are proprietary to the cache configuration

Since:

  • 0.9


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

def expire
  @expire
end

#hostObject

Additional properties which are proprietary to the cache configuration

Since:

  • 0.9


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

def host
  @host
end

#pathObject

Additional properties which are proprietary to the cache configuration

Since:

  • 0.9


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

def path
  @path
end

#portObject

Additional properties which are proprietary to the cache configuration

Since:

  • 0.9


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

def port
  @port
end

Class Method Details

.wipe_client_before_setting(*setters) ⇒ Object

Alias method chain to set the client to nil before an attribute of the configuration is set.

Parameters:

  • setters

    The attribute names for which the chain has to be installed

Since:

  • 0.9


21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/exchange/cache/configuration.rb', line 21

def wipe_client_before_setting *setters
  
  setters.each do |setter|
    define_method :"#{setter}_with_client_wipe=" do |data|
      wipe_subclass_client!
      send(:"#{setter}_without_client_wipe=", data)
    end
    alias_method :"#{setter}_without_client_wipe=", :"#{setter}="
    alias_method :"#{setter}=", :"#{setter}_with_client_wipe="             
  end
  
end

Instance Method Details

#keyObject

The key of the configuration

Since:

  • 0.9


61
62
63
# File 'lib/exchange/cache/configuration.rb', line 61

def key
  :cache
end

#parent_moduleObject

The parent module to get the constants from

Since:

  • 0.9


55
56
57
# File 'lib/exchange/cache/configuration.rb', line 55

def parent_module
  Cache
end

#set(hash) ⇒ Object

Overrides the parent class method to set the client to nil before setting the configuration via a hash

Parameters:

  • hash (Hash)

    The hash with the configuration options to set the configuration to

Since:

  • 0.9


47
48
49
50
# File 'lib/exchange/cache/configuration.rb', line 47

def set hash
  wipe_subclass_client!
  super
end