Class: Norman::HashProxySet
- Inherits:
-
Object
- Object
- Norman::HashProxySet
- Defined in:
- lib/norman/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.
41 42 43 |
# File 'lib/norman/hash_proxy.rb', line 41 def initialize @proxies = [] end |
Instance Attribute Details
#proxies ⇒ Object (readonly)
Returns the value of attribute proxies.
39 40 41 |
# File 'lib/norman/hash_proxy.rb', line 39 def proxies @proxies end |
Instance Method Details
#clear ⇒ Object
50 51 52 |
# File 'lib/norman/hash_proxy.rb', line 50 def clear proxies.map(&:clear) end |
#using(*args) ⇒ Object
45 46 47 48 |
# File 'lib/norman/hash_proxy.rb', line 45 def using(*args) args.size.times { proxies.push HashProxy.new } if proxies.empty? proxies.each_with_index {|proxy, index| proxy.using args[index] } end |