Class: GCOV::XMLFormatter
- Inherits:
-
Object
- Object
- GCOV::XMLFormatter
- Defined in:
- lib/xml_formatter.rb
Instance Method Summary collapse
-
#initialize(project, va = {}) ⇒ XMLFormatter
constructor
A new instance of XMLFormatter.
-
#print ⇒ Object
initialize.
Constructor Details
#initialize(project, va = {}) ⇒ XMLFormatter
Returns a new instance of XMLFormatter.
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 42 43 44 45 |
# File 'lib/xml_formatter.rb', line 13 def initialize project, va={} @project = project @xsl = va[:xsl] # @hash = { :files => { :file => [] } } @xml = Builder::XmlMarkup.new( :indent => 2 ) @xml.instruct! :xml, :encoding => "UTF-8" if @xsl @xml.instruct! :"xml-stylesheet", :href => @xsl, :type => "text/xsl" end @xml.projects do |xprojects| xprojects.project(:name=>"Test") do |xproject| xproject.files do |xfiles| @project.files.each do |file| xfiles.file(:name => file.name) do |xfile| xfile.lines do |xlines| file.lines.select{|line| line.number > 0}.each do |line| xlines.line(:number=>line.number,:count=>line.count) do |xline| xline.count line.count xline.text do |xtext| xtext.cdata! line.text end # xtext end # xline end # line end # xlines end # xfile end # file end # xfiles end # xproject end # xprojects end |
Instance Method Details
#print ⇒ Object
initialize
47 48 49 50 51 52 53 54 |
# File 'lib/xml_formatter.rb', line 47 def print # puts "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" # if @xslt # puts "<?xml-stylesheet href=\"#{@xslt}\" type=\"text/xsl\"?>" # end # puts Gyoku.xml( @hash ) puts @xml.target! end |