Class: Ambry::HashProxySet
- Inherits:
-
Object
- Object
- Ambry::HashProxySet
- Defined in:
- lib/ambry/hash_proxy.rb
Overview
Like HashProxy, but proxies access to two or more Hash instances.
Instance Attribute Summary collapse
-
#proxies ⇒ Object
readonly
Returns the value of attribute proxies.
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize ⇒ HashProxySet
constructor
A new instance of HashProxySet.
- #using(*args) ⇒ Object
Constructor Details
#initialize ⇒ HashProxySet
Returns a new instance of HashProxySet.
58 59 60 |
# File 'lib/ambry/hash_proxy.rb', line 58 def initialize @proxies = [] end |
Instance Attribute Details
#proxies ⇒ Object (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
#clear ⇒ Object
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 |