Sha256: 1cd21c8f09e2ccd8dcc191c85820821b3a35b416f60238e71f8ab0b5353d6a44

Contents?: true

Size: 580 Bytes

Versions: 2

Compression:

Stored size: 580 Bytes

Contents

require 'vedeu/output/text_adaptor'

module Vedeu
  class RawParser
    def self.parse(attributes)
      new(attributes).parse
    end

    def initialize(attributes)
      @attributes = attributes
    end

    def parse
      { interfaces: interfaces }
    end

    private

    attr_reader :attributes

    def interfaces
      stringified_keys.map do |name, content|
        {
          name:  name,
          lines: TextAdaptor.adapt(content)
        }
      end
    end

    def stringified_keys
      attributes.inject({}) { |a, (k, v)| a[k.to_s] = v; a }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.1.3 lib/vedeu/output/raw_parser.rb
vedeu-0.1.2 lib/vedeu/output/raw_parser.rb