# File lib/amrita/amx.rb, line 49def Template::[](f)
path = case f
when String
f
when REXML::Document
f.template_href
else
raise "unknown param #{f.type}"
end
doc = REXML::Document.new(REXML::File.new(path))
root = doc.elements['amx']
req = root.attributes['require']
require(req) if req
clsname = root.attributes['class']
cls = if clsname
eval clsname
else
Template
end
cls.new(path, doc)
end
new(path, doc)
# File lib/amrita/amx.rb, line 73def initialize(path, doc)
super()
@template_root = doc
@path = path
init_amx
end
Public Instance methods
init_amx()
# File lib/amrita/amx.rb, line 81def init_amx
@template_root.elements.to_a("amx/method").each do |m|
method_name = m.attributes['id'].to_s
code = m.elements['method_body'].get_text.to_s
define_method(method_name, code)
endend
# File lib/amrita/amx.rb, line 117def befor_expand
end
setup_template()
# File lib/amrita/amx.rb, line 120def setup_template
end
# File lib/amrita/amx.rb, line 124when REXML::Element
h = {}
h[k] = convert(v)
endend
}
when REXML::Elements
end
Node::to_node(ret)
when REXML::Text
when REXML::Instruction
"REXML::Instruction here(PENDING)"elseendend