class XCScheme::XML_Fromatter

Public Instance Methods

write_element(node, output) click to toggle source
# File lib/pebble_x/monkey_patches.rb, line 5
def write_element(node, output)
  @indentation = 3
  output << ' '*@level
  output << "<#{node.expanded_name}"

  @level += @indentation
  node.attributes.each_attribute do |attr|
    output << "\n"
    output << ' '*@level
    output << attr.to_string.sub(/=/, ' = ') # here's the patch (sub instead of gsub)
  end unless node.attributes.empty?

  output << ">"

  output << "\n"
  node.children.each { |child|
    next if child.kind_of?(REXML::Text) and child.to_s.strip.length == 0
    write(child, output)
    output << "\n"
  }
  @level -= @indentation
  output << ' '*@level
  output << "</#{node.expanded_name}>"
end