diff options
author | Xavier Noria <fxn@hashref.com> | 2011-03-27 20:45:23 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-03-27 20:45:23 +0200 |
commit | b2d94322e6f2c2324154465147938ca8b16c610d (patch) | |
tree | 4158d575b4b425e5d0b7b5c0087d2892daa41fa9 /actionpack/lib/action_view/template/resolver.rb | |
parent | cc6fa2f4d718c2d7a990fe23c38fc0ea4f2391d9 (diff) | |
download | rails-b2d94322e6f2c2324154465147938ca8b16c610d.tar.gz rails-b2d94322e6f2c2324154465147938ca8b16c610d.tar.bz2 rails-b2d94322e6f2c2324154465147938ca8b16c610d.zip |
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.
Diffstat (limited to 'actionpack/lib/action_view/template/resolver.rb')
-rw-r--r-- | actionpack/lib/action_view/template/resolver.rb | 4 |
1 files changed, 2 insertions, 2 deletions
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 |