aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/template.rb10
-rw-r--r--actionpack/lib/action_view/template_handlers.rb25
2 files changed, 8 insertions, 27 deletions
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb
index 8f4ca433c0..93748638c3 100644
--- a/actionpack/lib/action_view/template.rb
+++ b/actionpack/lib/action_view/template.rb
@@ -98,6 +98,10 @@ module ActionView #:nodoc:
end
private
+ def valid_extension?(extension)
+ Template.template_handler_extensions.include?(extension)
+ end
+
def find_full_path(path, load_paths)
load_paths = Array(load_paths) + [nil]
load_paths.each do |load_path|
@@ -111,11 +115,11 @@ module ActionView #:nodoc:
# [base_path, name, format, extension]
def split(file)
if m = file.match(/^(.*\/)?([^\.]+)\.?(\w+)?\.?(\w+)?\.?(\w+)?$/)
- if Template.valid_extension?(m[5]) # Multipart formats
+ if valid_extension?(m[5]) # Multipart formats
[m[1], m[2], "#{m[3]}.#{m[4]}", m[5]]
- elsif Template.valid_extension?(m[4]) # Single format
+ elsif valid_extension?(m[4]) # Single format
[m[1], m[2], m[3], m[4]]
- elsif Template.valid_extension?(m[3]) # No format
+ elsif valid_extension?(m[3]) # No format
[m[1], m[2], nil, m[3]]
else # No extension
[m[1], m[2], m[3], nil]
diff --git a/actionpack/lib/action_view/template_handlers.rb b/actionpack/lib/action_view/template_handlers.rb
index c50a51b0d1..d06ddd5fb5 100644
--- a/actionpack/lib/action_view/template_handlers.rb
+++ b/actionpack/lib/action_view/template_handlers.rb
@@ -28,10 +28,6 @@ module ActionView #:nodoc:
@@template_handlers[extension.to_sym] = klass
end
- def valid_extension?(extension)
- template_handler_extensions.include?(extension) || init_path_for_extension(extension)
- end
-
def template_handler_extensions
@@template_handlers.keys.map(&:to_s).sort
end
@@ -42,26 +38,7 @@ module ActionView #:nodoc:
end
def handler_class_for_extension(extension)
- (extension && @@template_handlers[extension.to_sym] || autoload_handler_class(extension)) ||
- @@default_template_handlers
+ (extension && @@template_handlers[extension.to_sym]) || @@default_template_handlers
end
-
- private
- def autoload_handler_class(extension)
- return if Gem.loaded_specs[extension]
- return unless init_path = init_path_for_extension(extension)
- Gem.activate(extension)
- load(init_path)
- handler_class_for_extension(extension)
- end
-
- # Returns the path to the rails/init.rb file for the given extension,
- # or nil if no gem provides it.
- def init_path_for_extension(extension)
- return unless spec = Gem.searcher.find(extension.to_s)
- returning File.join(spec.full_gem_path, 'rails', 'init.rb') do |path|
- return unless File.file?(path)
- end
- end
end
end