class CSVFormatter

Public Class Methods

new(report) click to toggle source
Calls superclass method BaseFormatter::new
# File lib/teuton/report/formatter/csv_formatter.rb, line 5
def initialize(report)
        super(report)
end

Public Instance Methods

process() click to toggle source
# File lib/teuton/report/formatter/csv_formatter.rb, line 9
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
process_datagroup(pGroup, delimiter=';') click to toggle source
# File lib/teuton/report/formatter/csv_formatter.rb, line 17
def process_datagroup(pGroup, delimiter=';')
        d = delimiter
        a = "DATAGROUP"+pGroup.order.to_s+d
        pGroup.head.each { |key,value| w a+"HEAD"+d+key.to_s+d+value.to_s+"\n" }
        pGroup.lines.each do |i|
                if i.class.to_s=='Hash' then
                        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
        pGroup.tail.each { |key,value| w a+"TAIL"+d+key.to_s+d+value.to_s+"\n" }
end