Class: XMLFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- XMLFormatter
- Defined in:
- lib/teuton/report/formatter/xml_formatter.rb
Instance Method Summary collapse
-
#initialize(pReport) ⇒ XMLFormatter
constructor
A new instance of XMLFormatter.
- #process ⇒ Object
Methods inherited from BaseFormatter
Constructor Details
#initialize(pReport) ⇒ XMLFormatter
Returns a new instance of XMLFormatter.
6 7 8 |
# File 'lib/teuton/report/formatter/xml_formatter.rb', line 6 def initialize(pReport) super(pReport) end |
Instance Method Details
#process ⇒ Object
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 40 41 |
# File 'lib/teuton/report/formatter/xml_formatter.rb', line 10 def process tab=" " w "<tt-checker version='0.2'>\n" w tab+"<head>\n" @head.each { |key,value| w tab*2+"<"+key.to_s+">"+value.to_s+"</"+key.to_s+">\n" } w tab+"</head>\n" w tab+"<lines>\n" @lines.each do |i| if i.class.to_s=='Hash' then w tab*2+"<line>\n" w tab*3+"<id>"+i[:id].to_s+"</id>\n" w tab*3+"<description>"+i[:description].to_s+"</description>\n" w tab*3+"<command" w " tempfile='"+i[:tempfile]+"'" if i[:tempfile] w ">"+i[:command].to_s+"</command>\n" w tab*3+"<check>"+i[:check].to_s+"</check>\n" w tab*3+"<weigth>"+i[:weight].to_s+"</weigth>\n" w tab*2+"</line>\n" else w tab*2+"<line type='log'>"+i.to_s+"</line>\n" end end w tab+"</lines>\n" w tab+"<tail>\n" @tail.each { |key,value| w tab*2+"<"+key.to_s+">"+value.to_s+"</"+key.to_s+">\n" } w tab+"</tail>\n" w "</tt-checker>\n" deinit end |