Deprecate use_in_file_templates!
Use enable :inline_templates instead
This commit is contained in:
parent
0067232e1f
commit
3ef8eedef2
|
@ -219,7 +219,7 @@ Or, specify an explicit Hash of local variables:
|
|||
This is typically used when rendering templates as partials from within
|
||||
other templates.
|
||||
|
||||
=== In-file Templates
|
||||
=== Inline Templates
|
||||
|
||||
Templates may be defined at the end of the source file:
|
||||
|
||||
|
@ -239,9 +239,9 @@ Templates may be defined at the end of the source file:
|
|||
@@ index
|
||||
%div.title Hello world!!!!!
|
||||
|
||||
NOTE: In-file templates defined in the source file that requires sinatra
|
||||
are automatically loaded. Call the <tt>use_in_file_templates!</tt>
|
||||
method explicitly if you have in-file templates in other source files.
|
||||
NOTE: Inline templates defined in the source file that requires sinatra
|
||||
are automatically loaded. Call `enable :inline_templates` explicitly if you
|
||||
have inline templates in other source files.
|
||||
|
||||
=== Named Templates
|
||||
|
||||
|
|
|
@ -4,4 +4,4 @@ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
|||
require 'sinatra/base'
|
||||
require 'sinatra/main'
|
||||
|
||||
use_in_file_templates!
|
||||
enable :inline_templates
|
||||
|
|
|
@ -720,10 +720,16 @@ module Sinatra
|
|||
template name, &block
|
||||
end
|
||||
|
||||
def use_in_file_templates!(file=nil)
|
||||
warn "use_in_file_templates! is deprecated; " \
|
||||
"use enable :inline_templates instead"
|
||||
set :inline_templates, file
|
||||
end
|
||||
|
||||
# Load embeded templates from the file; uses the caller's __FILE__
|
||||
# when no file is specified.
|
||||
def use_in_file_templates!(file=nil)
|
||||
file ||= caller_files.first
|
||||
def inline_templates=(file=nil)
|
||||
file = (file.nil? || file == true) ? caller_files.first : file
|
||||
|
||||
begin
|
||||
app, data =
|
||||
|
|
Loading…
Reference in New Issue