Class: Snmp2mkr::ConfigTypes::Oid

Inherits:
Base
  • Object
show all
Defined in:
lib/snmp2mkr/config_types/oid.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.



13
14
15
# File 'lib/snmp2mkr/config_types/oid.rb', line 13

def value
  @value
end

Instance Method Details

#collect_childrenObject



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

def collect_children
  [@value]
end

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



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

def evaluate(context: binded_context, previous: nil)
  value.evaluate(context: context, previous: previous)
end

#setup(str) ⇒ Object

Raises:

  • (TypeError)


8
9
10
11
# File 'lib/snmp2mkr/config_types/oid.rb', line 8

def setup(str)
  raise TypeError, 'Oid must be given a String or a TemplateString' unless str.kind_of?(String) || str.kind_of?(TemplateString)
  @value = str.is_a?(String) ? RawString.new(str) : str
end