lib/docparser/output/yaml_output.rb in docparser-0.0.1 vs lib/docparser/output/yaml_output.rb in docparser-0.1.0

- old
+ new

@@ -4,12 +4,17 @@ # 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[counter] rescue '' + if row.length > counter + @doc[@header[counter]] = row[counter] + else + @doc[@header[counter]] = '' + end end YAML.dump @doc, @file end end end \ No newline at end of file