Sha256: 3cf6b5f47e8a943af05f69f622279142f460dbfc41f6018582939030ea3def10

Contents?: true

Size: 494 Bytes

Versions: 1

Compression:

Stored size: 494 Bytes

Contents

module JunosConfig
  class Config
    attr_reader :config,
                :interfaces
    
    def initialize(config)
      @config = config
      config.scan(/^(\w+)\ \{$(.*?)^\}$/m).each do |section|
        method = "parse_#{section[0]}"
        send method, section[1] if respond_to?(method)
      end
    end
    
    def parse_interfaces(raw)
      @interfaces = raw.scan(/^(\ {4}\S+\ \{$.*?^\ {4}\})$/m).collect do |section|
        Interface.new section[0]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
junos-config-0.1.0 lib/junos-config/config.rb