class DocParser::YAMLOutput

The YAMLOutput class generates a YAML file containing all rows as seperate YAML documents @see Output

Public Instance Methods

write_row(row) click to toggle source

@!visibility private

# File lib/docparser/output/yaml_output.rb, line 10
def write_row(row)
  raise MissingHeaderException if @header.nil? || @header.empty?

  @doc ||= {}

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

  YAML.dump @doc, @file
end