Class: Xcodeproj::XCScheme::XML_Fromatter

Inherits:
Object
  • Object
show all
Defined in:
lib/pebble_x/monkey_patches.rb

Instance Method Summary collapse

Instance Method Details

#write_element(node, output) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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