Class: Tilt::BuilderTemplate

Inherits:
Template show all
Defined in:
lib/tilt/builder.rb

Overview

Instance Attribute Summary

Attributes inherited from Template

#data, #file, #line, #options

Instance Method Summary collapse

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



12
13
14
15
16
17
# File 'lib/tilt/builder.rb', line 12

def evaluate(scope, locals, &block)
  return super(scope, locals, &block) if data.respond_to?(:to_str)
  xml = ::Builder::XmlMarkup.new(:indent => 2)
  data.call(xml)
  xml.target!
end

#precompiled_postamble(locals) ⇒ Object



24
25
26
# File 'lib/tilt/builder.rb', line 24

def precompiled_postamble(locals)
  "xml.target!"
end

#precompiled_preamble(locals) ⇒ Object



19
20
21
22
# File 'lib/tilt/builder.rb', line 19

def precompiled_preamble(locals)
  return super if locals.include? :xml
  "xml = ::Builder::XmlMarkup.new(:indent => 2)\n#{super}"
end

#precompiled_template(locals) ⇒ Object



28
29
30
# File 'lib/tilt/builder.rb', line 28

def precompiled_template(locals)
  data.to_str
end

#prepareObject



10
# File 'lib/tilt/builder.rb', line 10

def prepare; end