Class: XMLFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- XMLFormatter
- Defined in:
- lib/teuton/report/formatter/default/xml.rb
Instance Attribute Summary
Attributes inherited from BaseFormatter
Instance Method Summary collapse
-
#initialize(report) ⇒ XMLFormatter
constructor
A new instance of XMLFormatter.
- #process(options = {}) ⇒ Object
Methods inherited from BaseFormatter
Constructor Details
permalink #initialize(report) ⇒ XMLFormatter
Returns a new instance of XMLFormatter.
5 6 7 8 |
# File 'lib/teuton/report/formatter/default/xml.rb', line 5 def initialize(report) super(report) @ext = "xml" end |
Instance Method Details
permalink #process(options = {}) ⇒ Object
[View source]
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/teuton/report/formatter/default/xml.rb', line 10 def process( = {}) tab = " " w "<teuton version='#{Teuton::VERSION}'>\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 |