diff options
author | José Valim <jose.valim@gmail.com> | 2010-12-01 11:22:48 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-12-01 11:22:48 +0100 |
commit | ba63c0a9b58691adeca645977828ee918107208d (patch) | |
tree | 3bfcfa25dbf527601921e0b51cf4b4006cd01265 /actionpack | |
parent | 831a2342c69f1d602aca9e894bffa4f6dbf614ed (diff) | |
download | rails-ba63c0a9b58691adeca645977828ee918107208d.tar.gz rails-ba63c0a9b58691adeca645977828ee918107208d.tar.bz2 rails-ba63c0a9b58691adeca645977828ee918107208d.zip |
Deprecate handler_class_for_extension as template handlers can be any Ruby object, not necessarily a class.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/renderer/template_renderer.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/template/handlers.rb | 8 | ||||
-rw-r--r-- | actionpack/lib/action_view/template/resolver.rb | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/renderer/template_renderer.rb b/actionpack/lib/action_view/renderer/template_renderer.rb index 6912acee31..ece3f621b6 100644 --- a/actionpack/lib/action_view/renderer/template_renderer.rb +++ b/actionpack/lib/action_view/renderer/template_renderer.rb @@ -45,7 +45,7 @@ module ActionView elsif options.key?(:file) with_fallbacks { find_template(options[:file], options[:prefix], false, keys) } elsif options.key?(:inline) - handler = Template.handler_class_for_extension(options[:type] || "erb") + handler = Template.handler_for_extension(options[:type] || "erb") Template.new(options[:inline], "inline template", handler, :locals => keys) elsif options.key?(:template) options[:template].respond_to?(:render) ? diff --git a/actionpack/lib/action_view/template/handlers.rb b/actionpack/lib/action_view/template/handlers.rb index 60347e2a95..4438199497 100644 --- a/actionpack/lib/action_view/template/handlers.rb +++ b/actionpack/lib/action_view/template/handlers.rb @@ -44,7 +44,13 @@ module ActionView #:nodoc: end def handler_class_for_extension(extension) - (extension && registered_template_handler(extension.to_sym)) || @@default_template_handlers + ActiveSupport::Deprecation.warn "handler_class_for_extension is deprecated. " << + "Please use handler_for_extension instead", caller + handler_for_extension(extension) + end + + def handler_for_extension(extension) + registered_template_handler(extension) || @@default_template_handlers end end end diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb index 7707dbcf98..9f15661669 100644 --- a/actionpack/lib/action_view/template/resolver.rb +++ b/actionpack/lib/action_view/template/resolver.rb @@ -129,7 +129,7 @@ module ActionView def extract_handler_and_format(path, default_formats) pieces = File.basename(path).split(".") pieces.shift - handler = Template.handler_class_for_extension(pieces.pop) + handler = Template.handler_for_extension(pieces.pop) format = pieces.last && Mime[pieces.last] [handler, format] end |