From 056bd7bb770884d064c4a94e23cd16d38b11c474 Mon Sep 17 00:00:00 2001 From: Blake Mizerany Date: Thu, 17 Dec 2009 18:25:18 -0800 Subject: [PATCH] closes #308 - Depricate use_in_file_templates! in favor of slurp_file_templates --- lib/sinatra.rb | 2 +- lib/sinatra/base.rb | 4 ++-- test/templates_test.rb | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/sinatra.rb b/lib/sinatra.rb index ce3ad6a4..448d27b2 100644 --- a/lib/sinatra.rb +++ b/lib/sinatra.rb @@ -4,4 +4,4 @@ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) require 'sinatra/base' require 'sinatra/main' -use_in_file_templates! +slup_file_templates diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index 780b8740..6d809e1a 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -722,7 +722,7 @@ module Sinatra # Load embeded templates from the file; uses the caller's __FILE__ # when no file is specified. - def use_in_file_templates!(file=nil) + def slup_file_templates(file=nil) file ||= caller_files.first begin @@ -1119,7 +1119,7 @@ module Sinatra delegate :get, :put, :post, :delete, :head, :template, :layout, :before, :after, :error, :not_found, :configure, :set, :mime_type, :enable, :disable, :use, :development?, :test?, - :production?, :use_in_file_templates!, :helpers + :production?, :slup_file_templates, :helpers end # Create a new Sinatra application. The block is evaluated in the new app's diff --git a/test/templates_test.rb b/test/templates_test.rb index 2f8d4e50..b01ab2e4 100644 --- a/test/templates_test.rb +++ b/test/templates_test.rb @@ -76,9 +76,9 @@ class TemplatesTest < Test::Unit::TestCase assert_equal "Layout 3!\nHello World!\n", body end - it 'loads templates from source file with use_in_file_templates!' do + it 'loads templates from source file with slup_file_templates' do mock_app { - use_in_file_templates! + slup_file_templates } assert_equal "this is foo\n\n", @app.templates[:foo][0] assert_equal "X\n= yield\nX\n", @app.templates[:layout][0] @@ -90,10 +90,10 @@ class TemplatesTest < Test::Unit::TestCase assert_equal "from another views directory\n", body end - test 'use_in_file_templates simply ignores IO errors' do + test 'slup_file_templates simply ignores IO errors' do assert_nothing_raised { mock_app { - use_in_file_templates!('/foo/bar') + slup_file_templates('/foo/bar') } }