Sha256: 8dca2c1db60be55b868c5b33634146a461d238a07effee1b76d7d9b84dcb08b4

Contents?: true

Size: 736 Bytes

Versions: 5

Compression:

Stored size: 736 Bytes

Contents

require_relative "base_formatter"

class CSVFormatter < BaseFormatter
	def process
		d = ";"
		@head.each { |key, value| w "HEAD#{d}#{key}#{d}#{value}\n" }
		@datagroups.each { |item| process_datagroup(item,d) }
		@tail.each { |key, value| w "TAIL#{d}#{key}#{d}#{value}\n" }
		deinit
	end

	def process_datagroup(group, delimiter = ";")
		d = delimiter
		a = "DATAGROUP#{group.order}#{d}"
		group.head.each { |key, value| w "#{a}HEAD#{d}#{key}#{d}#{value}\n" }
		group.lines.each do |i|
			if i.instance_of? Hash
				w "#{a}LINES#{d}ACTION#{d}#{i[:id]}#{d}#{i[:weight]}#{d}#{i[:description]}\n"
			else
        w "#{a}LINES#{d}LOG#{d}#{i}\n"
			end
		end
		group.tail.each { |key, value| w "#{a}TAIL#{d}#{key}#{d}#{value}\n" }
	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
teuton-2.3.11 lib/teuton/report/formatter/csv_formatter.rb
teuton-2.3.10 lib/teuton/report/formatter/csv_formatter.rb
teuton-2.3.9 lib/teuton/report/formatter/csv_formatter.rb
teuton-2.3.8 lib/teuton/report/formatter/csv_formatter.rb
teuton-2.3.7 lib/teuton/report/formatter/csv_formatter.rb