lib/docparser/output/yaml_output.rb in docparser-0.1.4 vs lib/docparser/output/yaml_output.rb in docparser-0.1.6

- old
+ new

@@ -6,16 +6,14 @@ 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| - if row.length > counter - @doc[@header[counter]] = row[counter] - else - @doc[@header[counter]] = '' - end + @doc[@header[counter]] = row.length > counter ? row[counter] : '' end + YAML.dump @doc, @file end end -end \ No newline at end of file +end