Class: REXML::Formatters::Transitive

Inherits:
Object
  • Object
show all
Defined in:
lib/rcov/report.rb

Instance Method Summary collapse

Instance Method Details

#write_element(node, output) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/rcov/report.rb', line 52

def write_element( node, output )
    output << "<#{node.expanded_name}"

    node.attributes.each_attribute do |attr|
        output << " "
        attr.write( output )
    end unless node.attributes.empty?

    if node.children.empty?
        output << "/>"
    else
        output << ">"
        # If compact and all children are text, and if the formatted output
        # is less than the specified width, then try to print everything on
        # one line
        skip = false
        @level += @indentation
        node.children.each { |child|
            write( child, output )
        }
        @level -= @indentation
        output << "</#{node.expanded_name}>"
    end
    output << "\n"
    output << ' '*@level
end