Sha256: e52c4e0ede26204b1565f2825e6ec838ab0243f5b22d337b34567d766211b600

Contents?: true

Size: 494 Bytes

Versions: 1

Compression:

Stored size: 494 Bytes

Contents

require 'yaml'
module DocParser
  # The YAMLOutput class generates a YAML file containing all rows as seperate
  # YAML documents
  # @see Output
  class YAMLOutput < Output
    # @!visibility private
    def write_row(row)
      raise MissingHeaderException if @header.nil? || @header.length == 0
      @doc ||= {}

      0.upto(@header.length - 1) do |counter|
        @doc[@header[counter]] = row.length > counter ? row[counter] : ''
      end

      YAML.dump @doc, @file
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docparser-0.1.6 lib/docparser/output/yaml_output.rb