Class: Tilt::BuilderTemplate

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

Overview

Instance Attribute Summary

Attributes inherited from Template

#data, #file, #line, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Template

#allows_script?, #basename, #default_encoding, #eval_file, #initialize, #name, #read_template_file, #render

Constructor Details

This class inherits a constructor from Tilt::Template

Class Method Details

.engine_initialized?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/vendor/tilt-1.4.1/lib/tilt/builder.rb', line 9

def self.engine_initialized?
  defined? ::Builder
end

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object



19
20
21
22
23
24
# File 'lib/vendor/tilt-1.4.1/lib/tilt/builder.rb', line 19

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

#initialize_engineObject



13
14
15
# File 'lib/vendor/tilt-1.4.1/lib/tilt/builder.rb', line 13

def initialize_engine
  require_template_library 'builder'
end

#precompiled_postamble(locals) ⇒ Object



31
32
33
# File 'lib/vendor/tilt-1.4.1/lib/tilt/builder.rb', line 31

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

#precompiled_preamble(locals) ⇒ Object



26
27
28
29
# File 'lib/vendor/tilt-1.4.1/lib/tilt/builder.rb', line 26

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

#precompiled_template(locals) ⇒ Object



35
36
37
# File 'lib/vendor/tilt-1.4.1/lib/tilt/builder.rb', line 35

def precompiled_template(locals)
  data.to_str
end

#prepareObject



17
# File 'lib/vendor/tilt-1.4.1/lib/tilt/builder.rb', line 17

def prepare; end