Class: Ambry::HashProxySet

Inherits:
Object
  • Object
show all
Defined in:
lib/ambry/hash_proxy.rb

Overview

Like HashProxy, but proxies access to two or more Hash instances.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHashProxySet


58
59
60
# File 'lib/ambry/hash_proxy.rb', line 58

def initialize
  @proxies = []
end

Instance Attribute Details

#proxiesObject (readonly)

Returns the value of attribute proxies


56
57
58
# File 'lib/ambry/hash_proxy.rb', line 56

def proxies
  @proxies
end

Instance Method Details

#clearObject


67
68
69
# File 'lib/ambry/hash_proxy.rb', line 67

def clear
  proxies.map(&:clear)
end

#using(*args) ⇒ Object


62
63
64
65
# File 'lib/ambry/hash_proxy.rb', line 62

def using(*args)
  args.size.times { proxies.push HashProxy.new } if proxies.empty?
  proxies.each_with_index {|proxy, index| proxy.using args[index] }
end