Class: CiscoConfigParse

Inherits:
Object
  • Object
show all
Defined in:
lib/cisco-config-parse.rb

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ CiscoConfigParse

Returns a new instance of CiscoConfigParse.



4
5
6
# File 'lib/cisco-config-parse.rb', line 4

def initialize(io)
    @io = io
end

Instance Method Details

#get_hostnameObject



28
29
30
# File 'lib/cisco-config-parse.rb', line 28

def get_hostname
    return @config_hostname
end

#get_interfacesObject



20
21
22
# File 'lib/cisco-config-parse.rb', line 20

def get_interfaces
    return @interfaces
end

#get_versionObject



32
33
34
# File 'lib/cisco-config-parse.rb', line 32

def get_version
    return @software_version
end

#get_vlansObject



24
25
26
# File 'lib/cisco-config-parse.rb', line 24

def get_vlans
    return @vlans
end

#parseObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cisco-config-parse.rb', line 8

def parse
    @io.each do |line|
        if line =~ /^\!$/ or line =~ /^$/ # terminate current block
            end_config
            next
        elsif line =~ /^\!/ # Comment
            next
        end
        parse_config(line)
    end
end