Class: Puppet::Util::NetworkDevice::Cisco_ios::Model::StringValue

Inherits:
ScopedValue
  • Object
show all
Extended by:
ValueHelper
Defined in:
lib/puppet/util/network_device/cisco_ios/model/string_value.rb

Instance Method Summary collapse

Instance Method Details

#get_fragmentObject



15
16
17
18
# File 'lib/puppet/util/network_device/cisco_ios/model/string_value.rb', line 15

def get_fragment
  return fragment.call if fragment.is_a?(Proc)
  self.value == :absent ? nil : ERB.new(fragment).result(binding)
end

#parse(txt) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/puppet/util/network_device/cisco_ios/model/string_value.rb', line 26

def parse(txt)
  txt = extract_scope(txt)
  if txt.nil? || txt.empty?
    Puppet.debug("Scope #{scope} not found for Param #{name}")
    return
    self.evaluated = true
  end
  if self.match.is_a?(Proc)
    self.value = self.match.call(txt)
  else
    self.value = txt.scan(self.match).flatten[self.idx]
  end
  self.evaluated = true
end

#supported?Boolean

Since we dont have the #add and #remove methods provide something else to make sure that the param is supported on the hw /sw platform we are on

Returns:

  • (Boolean)


22
23
24
# File 'lib/puppet/util/network_device/cisco_ios/model/string_value.rb', line 22

def supported?
  !!supported
end