Class: RspecJunit::MergedXml

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_junit/merged_xml.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml_path) ⇒ MergedXml

Returns a new instance of MergedXml.



5
6
7
8
9
10
# File 'lib/rspec_junit/merged_xml.rb', line 5

def initialize(xml_path)
  fail "Invalid path to xml file: #{xml_path}" unless File.file?(xml_path)
  @xml_path  = xml_path
  @base_path = File.dirname xml_path
  reset
end

Instance Attribute Details

#base_pathObject (readonly)

Returns the value of attribute base_path.



3
4
5
# File 'lib/rspec_junit/merged_xml.rb', line 3

def base_path
  @base_path
end

#xml_pathObject (readonly)

Returns the value of attribute xml_path.



3
4
5
# File 'lib/rspec_junit/merged_xml.rb', line 3

def xml_path
  @xml_path
end

Instance Method Details

#splitObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rspec_junit/merged_xml.rb', line 12

def split
  reset

  File.foreach(xml_path) do |line|
    if line.match XML_START
      dump_file unless xml_count == 0
      @data      = ''
      @xml_count += 1
    end

    @data += "#{line}"
  end
end