Sha256: e09ec9b49bcee9e9679a1f676623c5e95a099dd7878f60bb77248d63a3d33839

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

require 'vedeu/parsing/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

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.1.1 lib/vedeu/parsing/raw_parser.rb