From cc90adfd2a171c5fc9f90f6a6506c5ac937efab3 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Thu, 18 Aug 2011 02:59:02 -0700 Subject: 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. --- actionpack/lib/action_view/template/resolver.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack') 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. -- cgit v1.2.3