Class: Tilt::BuilderTemplate
Overview
Instance Attribute Summary
Attributes inherited from Template
#data, #file, #line, #options
Instance Method Summary
collapse
Methods inherited from Template
#basename, #compile, #eval_file, #initialize, #name, #render
Constructor Details
This class inherits a constructor from Tilt::Template
Instance Method Details
#compile! ⇒ Object
335
336
|
# File 'lib/sinatra/tilt.rb', line 335
def compile!
end
|
#evaluate(scope, locals, &block) ⇒ Object
338
339
340
341
342
343
344
345
346
347
|
# File 'lib/sinatra/tilt.rb', line 338
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_engine ⇒ Object
331
332
333
|
# File 'lib/sinatra/tilt.rb', line 331
def initialize_engine
require_template_library 'builder' unless defined?(::Builder)
end
|
#template_source ⇒ Object
349
350
351
|
# File 'lib/sinatra/tilt.rb', line 349
def template_source
data.to_str
end
|