Class: XMLFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- XMLFormatter
- Defined in:
- lib/teuton/report/formatter/xml_formatter.rb
Instance Method Summary collapse
Methods inherited from BaseFormatter
#deinit, #init, #initialize, #trim, #w
Constructor Details
This class inherits a constructor from BaseFormatter
Instance Method Details
#process ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/teuton/report/formatter/xml_formatter.rb', line 4 def process tab = " " w "<teuton version='0.2'>\n" w "#{tab}<head>\n" @head.each { |key, value| w "#{tab * 2}<#{key}>#{value}</#{key}>\n" } w "#{tab}</head>\n" w "#{tab}<lines>\n" @lines.each do |i| unless i.instance_of? Hash w "#{tab * 2}<line type='log'>#{i}</line>\n" next end w "#{tab * 2}<line>\n" w "#{tab * 3}<id>#{i[:id]}</id>\n" w "#{tab * 3}<description>#{i[:description]}</description>\n" w "#{tab * 3}<command" w " tempfile='#{i[:tempfile]}'" if i[:tempfile] w ">#{i[:command]}</command>\n" w "#{tab * 3}<check>#{i[:check]}</check>\n" w "#{tab * 3}<weigth>#{i[:weight]}</weigth>\n" w "#{tab * 2}</line>\n" end w "#{tab}</lines>\n" w "#{tab}<tail>\n" @tail.each { |key, value| w "#{tab * 2}<#{key}>#{value}</#{key}>\n" } w "#{tab}</tail>\n" w "</teuton>\n" deinit end |