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

- (Object) evaluate(scope, locals, &block)



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

- (Object) precompiled_postamble(locals)



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

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

- (Object) precompiled_preamble(locals)



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

- (Object) precompiled_template(locals)



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

def precompiled_template(locals)
  data.to_str
end

- (Object) prepare



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

def prepare; end