Class: Tilt::BuilderTemplate

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

Overview

Builder template implementation. See: builder.rubyforge.org/

Instance Attribute Summary

Attributes inherited from Template

#data, #file, #line, #options

Instance Method Summary collapse

Methods inherited from Template

#basename, #eval_file, #initialize, #name, #render

Constructor Details

This class inherits a constructor from Tilt::Template

Instance Method Details

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



564
565
566
567
568
569
570
571
572
573
# File 'lib/frank/tilt.rb', line 564

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

#initialize_engineObject



556
557
558
559
# File 'lib/frank/tilt.rb', line 556

def initialize_engine
  return if defined?(::Builder)
  require_template_library 'builder'
end

#precompiled_template(locals) ⇒ Object



575
576
577
# File 'lib/frank/tilt.rb', line 575

def precompiled_template(locals)
  data.to_str
end

#prepareObject



561
562
# File 'lib/frank/tilt.rb', line 561

def prepare
end