From b2d94322e6f2c2324154465147938ca8b16c610d Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sun, 27 Mar 2011 20:45:23 +0200 Subject: fixes a couple of regexps, the suite showed warnings about them A couple of things worth mentioning here: - "{" is a metacharacter, should be escaped if it is meant to match a "{". The code worked, though, because the regexp engine is tolerant to this, but issued warnings. - gsub accepts a string as first argument. That's the best idiom to use when your pattern has no metacharacters, since gsub interprets the string as an exact substring to look for, rather than a regexp. The benefit is that your pattern is crystal clear and needs no backslashes. --- actionpack/lib/action_view/template/resolver.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb index 6c1063592f..41c6310ae2 100644 --- a/actionpack/lib/action_view/template/resolver.rb +++ b/actionpack/lib/action_view/template/resolver.rb @@ -157,8 +157,8 @@ module ActionView query.gsub!(/\:#{ext}/, "{#{variants.compact.uniq.join(',')}}") } - query.gsub!(/\.{html,/, ".{html,text.html,") - query.gsub!(/\.{text,/, ".{text,text.plain,") + query.gsub!('.{html,', '.{html,text.html,') + query.gsub!('.{text,', '.{text,text.plain,') File.expand_path(query, @path) end -- cgit v1.2.3