Class: Norman::HashProxySet

Inherits:
Object
  • Object
show all
Defined in:
lib/norman/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

Returns a new instance of HashProxySet.



41
42
43
# File 'lib/norman/hash_proxy.rb', line 41

def initialize
  @proxies = []
end

Instance Attribute Details

#proxiesObject (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

#clearObject



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