Class: Snmp2mkr::ConfigTypes::TemplateCollection
- Inherits:
-
Base
- Object
- Base
- Snmp2mkr::ConfigTypes::TemplateCollection
show all
- Defined in:
- lib/snmp2mkr/config_types/template_collection.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#binded_context
Instance Method Summary
collapse
Methods inherited from Base
#bind_context, #children, #evaluate, #initialize, #inspect
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
27
28
29
|
# File 'lib/snmp2mkr/config_types/template_collection.rb', line 27
def value
@value
end
|
Instance Method Details
#[](k) ⇒ Object
15
16
17
|
# File 'lib/snmp2mkr/config_types/template_collection.rb', line 15
def [](k)
@value[k]
end
|
#collect_children ⇒ Object
23
24
25
|
# File 'lib/snmp2mkr/config_types/template_collection.rb', line 23
def collect_children
@value.values
end
|
#fetch(k) ⇒ Object
19
20
21
|
# File 'lib/snmp2mkr/config_types/template_collection.rb', line 19
def fetch(k)
@value.fetch(k)
end
|
#setup(hash) ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/snmp2mkr/config_types/template_collection.rb', line 7
def setup(hash)
if !hash.kind_of?(Hash) || hash.any? { |k,v| !k.kind_of?(String) }
raise TypeError, "#{self.class} must be given a Hash<String, Object)>"
end
@value = hash.map { |k, v| [k, Template.new([k,v])] }.to_h
end
|