mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
changed access to @template_cache to a reader.
This commit is contained in:
parent
5d4d140a45
commit
a5ceae91e8
2 changed files with 7 additions and 2 deletions
|
@ -355,7 +355,7 @@ module Sinatra
|
|||
end
|
||||
|
||||
def compile_template(engine, data, options, views)
|
||||
@template_cache.fetch engine, data, options do
|
||||
template_cache.fetch engine, data, options do
|
||||
template = Tilt[engine]
|
||||
raise "Template engine not found: #{engine}" if template.nil?
|
||||
|
||||
|
@ -387,6 +387,7 @@ module Sinatra
|
|||
include Templates
|
||||
|
||||
attr_accessor :app
|
||||
attr_reader :template_cache
|
||||
|
||||
def initialize(app=nil)
|
||||
@app = app
|
||||
|
@ -406,7 +407,7 @@ module Sinatra
|
|||
@request = Request.new(env)
|
||||
@response = Response.new
|
||||
@params = indifferent_params(@request.params)
|
||||
@template_cache.clear if settings.reload_templates
|
||||
template_cache.clear if settings.reload_templates
|
||||
|
||||
invoke { dispatch! }
|
||||
invoke { error_block!(response.status) }
|
||||
|
|
|
@ -10,4 +10,8 @@ class SinatraTest < Test::Unit::TestCase
|
|||
end
|
||||
assert_same Sinatra::Base, app.superclass
|
||||
end
|
||||
|
||||
it "responds to #template_cache" do
|
||||
assert_kind_of Tilt::Cache, Sinatra::Base.new.template_cache
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue