Class: Snmp2mkr::ConfigTypes::TemplatesList

Inherits:
Base
  • Object
show all
Defined in:
lib/snmp2mkr/config_types/templates_list.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#binded_context

Instance Method Summary collapse

Methods inherited from Base

#bind_context, #children, #initialize, #inspect

Constructor Details

This class inherits a constructor from Snmp2mkr::ConfigTypes::Base

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



19
20
21
# File 'lib/snmp2mkr/config_types/templates_list.rb', line 19

def value
  @value
end

Instance Method Details

#collect_childrenObject



15
16
17
# File 'lib/snmp2mkr/config_types/templates_list.rb', line 15

def collect_children
  @value
end

#evaluate(context: binded_context, previous: nil) ⇒ Object



21
22
23
# File 'lib/snmp2mkr/config_types/templates_list.rb', line 21

def evaluate(context: binded_context, previous: nil)
  @value.map { |_| _.evaluate(context: context, previous: previous) }
end

#setup(ary) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/snmp2mkr/config_types/templates_list.rb', line 7

def setup(ary)
  if !ary.kind_of?(Array) || ary.any? { |_| !_.kind_of?(String) }
    raise TypeError, "#{self.class} must be given an Array<String>"
  end

  @value = ary.map { |_| TemplateString.new(_) }
end