Sha256: 5b773b4b2847458dea8b491dcc5698fef8b6abfaaf398ca17e03cc06b7bb9ae7

Contents?: true

Size: 707 Bytes

Versions: 3

Compression:

Stored size: 707 Bytes

Contents

$:.unshift File.dirname(__FILE__)

require 'rexml/document'
require 'template_runner'

module BuildMaster
  class TemplateException < Exception
  end
    
  class XTemplate
    def initialize(template_file)
      @template = REXML::Document.new(template_file)
    end
        
    def process(content, &evaluator)
      content_xml = REXML::Document.new(content)
      output_xml = process_xml(content_xml, &evaluator)
      return output_xml
    end
        
    private
    def process_xml(content_xml, &evaluator)
      result_xml = REXML::Document.new
      TemplateRunner.new(result_xml, @template, content_xml, &evaluator).process
      return result_xml
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
BuildMaster-0.5.0 lib/buildmaster/xtemplate.rb
BuildMaster-0.6.0 lib/buildmaster/xtemplate.rb
BuildMaster-0.7.0 lib/buildmaster/xtemplate.rb