Class: CiscoConfigParse
- Inherits:
-
Object
- Object
- CiscoConfigParse
- Defined in:
- lib/cisco-config-parse.rb
Instance Method Summary collapse
- #get_hostname ⇒ Object
- #get_interfaces ⇒ Object
- #get_version ⇒ Object
- #get_vlans ⇒ Object
-
#initialize(io) ⇒ CiscoConfigParse
constructor
A new instance of CiscoConfigParse.
- #parse ⇒ Object
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_hostname ⇒ Object
28 29 30 |
# File 'lib/cisco-config-parse.rb', line 28 def get_hostname return @config_hostname end |
#get_interfaces ⇒ Object
20 21 22 |
# File 'lib/cisco-config-parse.rb', line 20 def get_interfaces return @interfaces end |
#get_version ⇒ Object
32 33 34 |
# File 'lib/cisco-config-parse.rb', line 32 def get_version return @software_version end |
#get_vlans ⇒ Object
24 25 26 |
# File 'lib/cisco-config-parse.rb', line 24 def get_vlans return @vlans end |
#parse ⇒ Object
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 |