$:.unshift File.dirname(__FILE__) require 'rexml/document' require 'template_runner' module BuildMaster class XTemplate def initialize(template_file, templatelets = Hash.new) @template = REXML::Document.new(template_file) @templatelets = templatelets end def process(source, &evaluator) output_xml = process_xml(source, &evaluator) return output_xml end private def process_xml(source, &evaluator) output_xml = REXML::Document.new runner = TemplateRunner.new(output_xml, @template, source, &evaluator) runner.templatelets = @templatelets runner.process return output_xml end end end