Class Amrita::TemplateFile
In: lib/amrita/template.rb
Parent: Template
Methods
_load    expand    get_ivars_for_dump    load_template    need_update?    new    set_ivars_from   
Attributes
:auto_save  [RW] 
:path  [R] 
Public Class methods
new(path)
# File lib/amrita/template.rb, line 381
    def initialize(path)
      super()
      @path = path
      @auto_save = false
      @lastread = nil
    end
_load(s)
# File lib/amrita/template.rb, line 416
    def TemplateFile::_load(s)
      ret = TemplateFile.new('')
      ret.set_ivars_from(Marshal::load(s))
      ret
    end
Public Instance methods
need_update?()

template will be loaded again if modified.

# File lib/amrita/template.rb, line 389
    def need_update?
      return true unless @lastread
      @lastread < File::stat(@path).mtime
    end
load_template()
# File lib/amrita/template.rb, line 394
    def load_template
      setup_ep unless @ep
      ret = get_parser_class.parse_file(@path, tag_info, ep)
      @lastread = Time.now
      ret
    end
expand(stream, data)
# File lib/amrita/template.rb, line 401
    def expand(stream, data)
      super
      TemplateManager.instance.save_template(self) if @auto_save
    end
get_ivars_for_dump()
# File lib/amrita/template.rb, line 406
    def get_ivars_for_dump
      super + [ @path, @lastread ]
    end
set_ivars_from(a)
# File lib/amrita/template.rb, line 410
    def set_ivars_from(a)
      @lastread = a.pop
      @path = a.pop
      super(a)
    end