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.

Methods

builder   erb   haml   sass  

Public Instance methods

[Source]

     # File lib/sinatra/base.rb, line 237
237:     def builder(template=nil, options={}, &block)
238:       require 'builder' unless defined? ::Builder
239:       options, template = template, nil if template.is_a?(Hash)
240:       template = lambda { block } if template.nil?
241:       render :builder, template, options
242:     end

[Source]

     # File lib/sinatra/base.rb, line 220
220:     def erb(template, options={})
221:       require 'erb' unless defined? ::ERB
222:       render :erb, template, options
223:     end

[Source]

     # File lib/sinatra/base.rb, line 225
225:     def haml(template, options={})
226:       require 'haml' unless defined? ::Haml
227:       options[:options] ||= self.class.haml if self.class.respond_to? :haml
228:       render :haml, template, options
229:     end

[Source]

     # File lib/sinatra/base.rb, line 231
231:     def sass(template, options={}, &block)
232:       require 'sass' unless defined? ::Sass
233:       options[:layout] = false
234:       render :sass, template, options
235:     end

[Validate]