Class: Puppet::Util::NetworkDevice::Cisco_ios::Model::StringValue
- Inherits:
-
ScopedValue
- Object
- ScopedValue
- Puppet::Util::NetworkDevice::Cisco_ios::Model::StringValue
- Extended by:
- ValueHelper
- Defined in:
- lib/puppet/util/network_device/cisco_ios/model/string_value.rb
Instance Method Summary collapse
- #get_fragment ⇒ Object
- #parse(txt) ⇒ Object
-
#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.
Instance Method Details
#get_fragment ⇒ Object
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
22 23 24 |
# File 'lib/puppet/util/network_device/cisco_ios/model/string_value.rb', line 22 def supported? !!supported end |