class Tilt::BuilderTemplate

Builder template implementation.

Public Instance Methods

evaluate(scope, locals, &block) click to toggle source
Calls superclass method
   # File lib/tilt/builder.rb
18 def evaluate(scope, locals, &block)
19   if @data.respond_to?(:to_str)
20     unless locals[:xml]
21       locals = Hash[locals]
22       locals[:xml] = xml_builder
23     end
24     return super
25   end
26 
27   xml = locals[:xml] || xml_builder
28   @data.call(xml)
29   xml.target!
30 end
precompiled_postamble(locals) click to toggle source
   # File lib/tilt/builder.rb
32 def precompiled_postamble(locals)
33   "xml.target!"
34 end
precompiled_template(locals) click to toggle source
   # File lib/tilt/builder.rb
36 def precompiled_template(locals)
37   @data.to_str
38 end
prepare() click to toggle source
   # File lib/tilt/builder.rb
14 def prepare
15   @options[:indent] ||= 2
16 end

Private Instance Methods

xml_builder() click to toggle source
   # File lib/tilt/builder.rb
42 def xml_builder
43   ::Builder::XmlMarkup.new(options)
44 end