# File lib/ruote/parser.rb, line 94 def self.to_xml (tree, options={}) require 'builder' # TODO : deal with "participant 'toto'" builder(options) do |xml| atts = tree[1].dup t = atts.find { |k, v| v == nil } if t atts.delete(t.first) key = tree[0] == 'if' ? 'test' : 'ref' atts[key] = t.first end atts = atts.inject({}) { |h, (k, v)| h[k.to_s.gsub(/\_/, '-')] = v; h } if tree[2].empty? xml.tag!(tree[0], atts) else xml.tag!(tree[0], atts) do tree[2].each { |child| to_xml(child, options) } end end end end