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
14 def evaluate(scope, locals, &block)
15   if @data.respond_to?(:to_str)
16     unless locals[:xml]
17       locals = Hash[locals]
18       locals[:xml] = xml_builder
19     end
20     return super
21   end
22 
23   xml = locals[:xml] || xml_builder
24   @data.call(xml)
25   xml.target!
26 end
precompiled_postamble(locals) click to toggle source
   # File lib/tilt/builder.rb
28 def precompiled_postamble(locals)
29   "xml.target!"
30 end
precompiled_template(locals) click to toggle source
   # File lib/tilt/builder.rb
32 def precompiled_template(locals)
33   @data.to_str
34 end
prepare() click to toggle source
   # File lib/tilt/builder.rb
10 def prepare
11   @options[:indent] ||= 2
12 end

Private Instance Methods

xml_builder() click to toggle source
   # File lib/tilt/builder.rb
38 def xml_builder
39   ::Builder::XmlMarkup.new(options)
40 end