Module Sinatra::Templates
In: lib/sinatra/base.rb

Template rendering methods. Each method takes a the name of a template to render as a Symbol and returns a String with the rendered output, as well as an optional hash with additional options.

`template` is either the name or path of the template as symbol (Use `:’subdir/myview’` for views in subdirectories), or a string that will be rendered.

Possible options are:

  :layout       If set to false, no layout is rendered, otherwise
                the specified layout is used (Ignored for `sass`)
  :locals       A hash with local variables that should be available
                in the template

Methods

builder   erb   haml   sass  

Public Instance methods

[Source]

     # File lib/sinatra/base.rb, line 257
257:     def builder(template=nil, options={}, locals={}, &block)
258:       require_warn('Builder') unless defined?(::Builder)
259: 
260:       options, template = template, nil if template.is_a?(Hash)
261:       template = lambda { block } if template.nil?
262:       render :builder, template, options, locals
263:     end

[Source]

     # File lib/sinatra/base.rb, line 238
238:     def erb(template, options={}, locals={})
239:       require_warn('ERB') unless defined?(::ERB)
240: 
241:       render :erb, template, options, locals
242:     end

[Source]

     # File lib/sinatra/base.rb, line 244
244:     def haml(template, options={}, locals={})
245:       require_warn('Haml') unless defined?(::Haml::Engine)
246: 
247:       render :haml, template, options, locals
248:     end

[Source]

     # File lib/sinatra/base.rb, line 250
250:     def sass(template, options={}, locals={})
251:       require_warn('Sass') unless defined?(::Sass::Engine)
252: 
253:       options[:layout] = false
254:       render :sass, template, options, locals
255:     end

[Validate]