Method: Cisco::ConfigParser::Configuration#compare_with
- Defined in:
- lib/cisco_node_utils/configparser_lib.rb
#compare_with(config) ⇒ String
Compare ConfigParser::Configuration objects
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/cisco_node_utils/configparser_lib.rb', line 109 def compare_with(config) return nil if config.nil? existing = '' @ordered_keys.each do |config_line| command = config_line.strip submode = @configuration[command] fail StopIteration, 'Could not find submode.' if submode.nil? if special_command?(command) # match special exit/end command existing << config_line break elsif config.include_command?(command) # match whole command existing << config_line config_submode = config.submode_config(command) existing << submode.compare_with(config_submode) next end # if prefix, base = base_commands(command) if prefix != '' && !config.include_command?(base) existing << config_line next end end existing end |