Class: Tilt::BuilderTemplate
Overview
Builder template implementation. See: builder.rubyforge.org/
Instance Attribute Summary
Attributes inherited from Template
#compiled_path, #data, #file, #line, #options
Instance Method Summary collapse
- #evaluate(scope, locals, &block) ⇒ Object
- #precompiled_postamble(locals) ⇒ Object
- #precompiled_template(locals) ⇒ Object
- #prepare ⇒ Object
Methods inherited from Template
#basename, default_mime_type, default_mime_type=, #eval_file, #initialize, metadata, #metadata, #name, #render
Constructor Details
This class inherits a constructor from Tilt::Template
Instance Method Details
#evaluate(scope, locals, &block) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/tilt/builder.rb', line 14 def evaluate(scope, locals, &block) xml = (locals[:xml] || ::Builder::XmlMarkup.new()) if data.respond_to?(:to_str) if !locals[:xml] locals = locals.merge(:xml => xml) end return super(scope, locals, &block) end data.call(xml) xml.target! end |
#precompiled_postamble(locals) ⇒ Object
28 29 30 |
# File 'lib/tilt/builder.rb', line 28 def precompiled_postamble(locals) "xml.target!" end |
#precompiled_template(locals) ⇒ Object
32 33 34 |
# File 'lib/tilt/builder.rb', line 32 def precompiled_template(locals) data.to_str end |
#prepare ⇒ Object
10 11 12 |
# File 'lib/tilt/builder.rb', line 10 def prepare [:indent] ||= 2 end |