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.
# 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
# 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
# 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