Class: PuppetX::Eos::ModuleBase
- Inherits:
-
Object
- Object
- PuppetX::Eos::ModuleBase
- Defined in:
- lib/puppet_x/eos/module_base.rb
Overview
ModuleBase provides a base class for other modules to inherit from. Methods common to all modules should be placed here.
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
Instance Method Summary collapse
-
#initialize(api) ⇒ PuppetX::Eos::ModuleBase
constructor
Initialize instance of Module.
-
#running_configuration ⇒ String
private
running_configuration returns the current running configuration as a string.
Constructor Details
#initialize(api) ⇒ PuppetX::Eos::ModuleBase
Initialize instance of Module. The Module class provides instance methods to configure module related resources on the target device.
18 19 20 |
# File 'lib/puppet_x/eos/module_base.rb', line 18 def initialize(api) @api = api end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
9 10 11 |
# File 'lib/puppet_x/eos/module_base.rb', line 9 def api @api end |
Instance Method Details
#running_configuration ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
running_configuration returns the current running configuration as a string. This method is intended to be used by subclasses. The running configuration is returned as a single string object to faciliate the use of String#scan
31 32 33 34 |
# File 'lib/puppet_x/eos/module_base.rb', line 31 def running_configuration result = api.enable('show running-config', format: 'text') result.last['output'] end |