1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

Use Templates.initialize to init @default_layout without warning

This commit is contained in:
David Kellum 2011-06-01 22:02:38 -07:00
parent b6d589e585
commit 840242efb3

View file

@ -359,6 +359,10 @@ module Sinatra
attr_accessor :content_type attr_accessor :content_type
end end
def initialize
@default_layout = :layout
end
def erb(template, options={}, locals={}) def erb(template, options={}, locals={})
render :erb, template, options, locals render :erb, template, options, locals
end end
@ -462,7 +466,6 @@ module Sinatra
# extract generic options # extract generic options
locals = options.delete(:locals) || locals || {} locals = options.delete(:locals) || locals || {}
views = options.delete(:views) || settings.views || "./views" views = options.delete(:views) || settings.views || "./views"
@default_layout = :layout if @default_layout.nil?
layout = options.delete(:layout) layout = options.delete(:layout)
eat_errors = layout.nil? eat_errors = layout.nil?
layout = @default_layout if layout.nil? or layout == true layout = @default_layout if layout.nil? or layout == true
@ -533,6 +536,7 @@ module Sinatra
attr_reader :template_cache attr_reader :template_cache
def initialize(app=nil) def initialize(app=nil)
super()
@app = app @app = app
@template_cache = Tilt::Cache.new @template_cache = Tilt::Cache.new
yield self if block_given? yield self if block_given?