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

Merge pull request #284 from dekellum/fix-init-warnings

Fix no-initialization warning for @default_layout
This commit is contained in:
Konstantin Haase 2011-06-04 00:14:08 -07:00
commit 447b6c1e01

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?