Included Modules

Sinatra::Templates

Template rendering methods. Each method takes 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` and `less`)
:locals       A hash with local variables that should be available
              in the template

Public Instance Methods

builder(template=nil, options={}, locals={}, &block) click to toggle source
# File lib/sinatra/base.rb, line 324
def builder(template=nil, options={}, locals={}, &block)
  options, template = template, nil if template.is_a?(Hash)
  template = Proc.new { block } if template.nil?
  render :builder, template, options, locals
end
erb(template, options={}, locals={}) click to toggle source
# File lib/sinatra/base.rb, line 300
def erb(template, options={}, locals={})
  options[:outvar] = '@_out_buf'
  render :erb, template, options, locals
end
erubis(template, options={}, locals={}) click to toggle source
# File lib/sinatra/base.rb, line 305
def erubis(template, options={}, locals={})
  options[:outvar] = '@_out_buf'
  render :erubis, template, options, locals
end
haml(template, options={}, locals={}) click to toggle source
# File lib/sinatra/base.rb, line 310
def haml(template, options={}, locals={})
  render :haml, template, options, locals
end
less(template, options={}, locals={}) click to toggle source
# File lib/sinatra/base.rb, line 319
def less(template, options={}, locals={})
  options[:layout] = false
  render :less, template, options, locals
end
sass(template, options={}, locals={}) click to toggle source
# File lib/sinatra/base.rb, line 314
def sass(template, options={}, locals={})
  options[:layout] = false
  render :sass, template, options, locals
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.