Sha256: c3d80aaebf04f1aef19fa214dfb9bf6db07acd010cda74cc591b5b2fd8dbbba9
Contents?: true
Size: 1.52 KB
Versions: 51
Compression:
Stored size: 1.52 KB
Contents
module Processor def load_tags(content, cdb) begin context = Radius::Context.new do |c| # map all parameters from 'content' to a tag with the same name content.each do |content_param| c.define_tag "#{content_param.first}" do |tag| tag = content_param.last end end # include external file c.define_tag 'include' do |tag| result = '' ext_file = File.join( ENV['WORKSPACE'], tag.attr['file'] ) if File.exists?(ext_file) result = File.open(ext_file).read else puts "Warning: can not read static data " + ext_file end result end c.define_tag 'cdb' do |tag| result = '' if not cdb.nil? or cdb[tag.attr['key']].nil? result = cdb[tag.attr['key']] else puts "Warning: CDB not set for Template-Engine in tag 'cdb'" end result end c.define_tag 'feature_flag' do |tag| result = '' if not cdb.nil? feature = tag.attr['name'] result = cdb[cdb[feature]] else puts "Warning: CDB not set for Template-Engine in tag 'feature_flag'" end result end c.define_tag "echo" do |tag| tag.expand end end rescue Exception => e $log.writer.error "Error in tag definition: #{e.message}" $log.writer.error e.backtrace exit 1 end context end end
Version data entries
51 entries across 51 versions & 1 rubygems