aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-08-18 02:59:02 -0700
committerXavier Noria <fxn@hashref.com>2011-08-18 03:09:18 -0700
commitcc90adfd2a171c5fc9f90f6a6506c5ac937efab3 (patch)
treefc016bcdad89a6a358375d8db86e296c374a53bf /actionpack
parent12c0ea954ae1245013902c485d5d3e794381e3df (diff)
downloadrails-cc90adfd2a171c5fc9f90f6a6506c5ac937efab3.tar.gz
rails-cc90adfd2a171c5fc9f90f6a6506c5ac937efab3.tar.bz2
rails-cc90adfd2a171c5fc9f90f6a6506c5ac937efab3.zip
minor details revised in a gsub
Regexps have a construct to express alternation of characters, which is character classes. In addition to being the most specific idiom to write this pattern, it reads better without the backslashes. Also, it is better not to use a capture if none is needed. As a side-effect of these changes, the gsub is marginally faster, but speed is not the point of this commit.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/template/resolver.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb
index e78d3a82be..f855ea257c 100644
--- a/actionpack/lib/action_view/template/resolver.rb
+++ b/actionpack/lib/action_view/template/resolver.rb
@@ -157,7 +157,7 @@ module ActionView
end
def escape_entry(entry)
- entry.gsub(/(\*|\[|\]|\{|\}|\?)/, "\\\\\\1")
+ entry.gsub(/[*?{}\[\]]/, '\\\\\\&')
end
# Returns the file mtime from the filesystem.