Google

"DTD/xhtml1-strict.dtd">
Class Amx::Template
In: lib/amrita/amx.rb
Parent: Amrita::Template
Methods
[]    befor_expand    define_method    expand    get_model    init_amx    new    setup_context    setup_template   
Attributes
:doc  [R] 
:root  [R] 
Included modules
ExpandByMember
Public Class methods
[](f)
# File lib/amrita/amx.rb, line 49
    def 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 73
    def initialize(path, doc)
      super()
      @template_root = doc
      @path = path
      init_amx
    end
Public Instance methods
init_amx()
# File lib/amrita/amx.rb, line 81
    def 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)
      end
    end
define_method(method_name, code)
# File lib/amrita/amx.rb, line 89
    def define_method(method_name, code)
      instance_eval "        def \#{method_name}\n          \#{code}\n        end\n"
    end
get_model()
# File lib/amrita/amx.rb, line 98
    def get_model
      self
    end
setup_context()
# File lib/amrita/amx.rb, line 102
    def setup_context
      context = AmxContext.new(self)
      context.delete_id = false if keep_id
      context
    end
expand(stream, doc)
# File lib/amrita/amx.rb, line 108
    def expand(stream, doc)
      @doc = doc
      befor_expand
      super(stream, get_model)
      puts ""
    ensure
      @doc = nil
    end
befor_expand()
# File lib/amrita/amx.rb, line 117
    def befor_expand
    end
setup_template()
# File lib/amrita/amx.rb, line 120
    def setup_template
    end
# File lib/amrita/amx.rb, line 124
      when REXML::Element
        h = {}
          h[k] = convert(v)
        end
          end
        }
      when REXML::Elements
        end
        Node::to_node(ret)
      when REXML::Text
      when REXML::Instruction
        "REXML::Instruction here(PENDING)"
      else
      end
    end