Jam Templates are data-driven templates. They take valid XML/XHTML documents and expand them based on the data structures provided.
New template from source file.
# File lib/jam/template.rb, line 26 def self.load(file, adapter=DEFAULT_ADAPTER, *options) new(File.read(file), adapter, *options) end
New template from source string.
# File lib/jam/template.rb, line 36 def initialize(source, adapter=DEFAULT_ADAPTER, *options) #@engine = Engine.new(adapter) @engine = Jam.const_get(adapter.to_s).new(*options) @source = source end
# File lib/jam/template.rb, line 43 def document @document ||= engine.document(@source) end
TODO: Should we render as doc, this might add a header, or render as root where it does not.
# File lib/jam/template.rb, line 50 def render(data) engine.interpolate(document, data).root.to_s end
Disabled; run with --debug to generate this.