aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/lib/fixture_template.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/lib/fixture_template.rb')
-rw-r--r--actionpack/test/lib/fixture_template.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/actionpack/test/lib/fixture_template.rb b/actionpack/test/lib/fixture_template.rb
index ee526b5de5..8da92180d1 100644
--- a/actionpack/test/lib/fixture_template.rb
+++ b/actionpack/test/lib/fixture_template.rb
@@ -4,7 +4,7 @@ module ActionView #:nodoc:
super(options)
@hash = hash
end
-
+
def find_templates(name, details, prefix, partial)
if regexp = details_to_regexp(name, details, prefix, partial)
cached(regexp) do
@@ -16,26 +16,26 @@ module ActionView #:nodoc:
end
end
end
-
+
private
-
+
def formats_regexp
@formats_regexp ||= begin
formats = Mime::SET.symbols
'(?:' + formats.map { |l| "\\.#{Regexp.escape(l.to_s)}" }.join('|') + ')?'
end
end
-
+
def handler_regexp
e = TemplateHandlers.extensions.map{|h| "\\.#{Regexp.escape(h.to_s)}"}.join("|")
- "(?:#{e})?"
+ "(?:#{e})"
end
-
+
def details_to_regexp(name, details, prefix, partial)
path = ""
path << "#{prefix}/" unless prefix.empty?
path << (partial ? "_#{name}" : name)
-
+
extensions = ""
[:locales, :formats].each do |k|
extensions << if exts = details[k]
@@ -47,7 +47,7 @@ module ActionView #:nodoc:
%r'^#{Regexp.escape(path)}#{extensions}#{handler_regexp}$'
end
-
+
# TODO: fix me
# :api: plugin
def path_to_details(path)
@@ -56,10 +56,10 @@ module ActionView #:nodoc:
partial = m[1] == '_'
details = (m[2]||"").split('.').reject { |e| e.empty? }
handler = Template.handler_class_for_extension(m[3])
-
+
format = Mime[details.last] && details.pop.to_sym
locale = details.last && details.pop.to_sym
-
+
return handler, :format => format, :locale => locale, :partial => partial
end
end