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 244
244:     def builder(template=nil, options={}, locals={}, &block)
245:       require_warn('Builder') unless defined?(::Builder)
246: 
247:       options, template = template, nil if template.is_a?(Hash)
248:       template = lambda { block } if template.nil?
249:       render :builder, template, options, locals
250:     end

[Source]

     # File lib/sinatra/base.rb, line 225
225:     def erb(template, options={}, locals={})
226:       require_warn('ERB') unless defined?(::ERB)
227: 
228:       render :erb, template, options, locals
229:     end

[Source]

     # File lib/sinatra/base.rb, line 231
231:     def haml(template, options={}, locals={})
232:       require_warn('Haml') unless defined?(::Haml::Engine)
233: 
234:       render :haml, template, options, locals
235:     end

[Source]

     # File lib/sinatra/base.rb, line 237
237:     def sass(template, options={}, locals={})
238:       require_warn('Sass') unless defined?(::Sass::Engine)
239: 
240:       options[:layout] = false
241:       render :sass, template, options, locals
242:     end

[Validate]