Skip to content

Commit

Permalink
minor details revised in a gsub
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fxn committed Aug 18, 2011
1 parent 4b411c8 commit 0df00d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/template/resolver.rb
Expand Up @@ -164,7 +164,7 @@ def build_query(path, details)
end

def escape_entry(entry)
entry.gsub(/(\*|\[|\]|\{|\}|\?)/, "\\\\\\1")
entry.gsub(/[*?{}\[\]]/, '\\\\\\&')
end

# Returns the file mtime from the filesystem.
Expand Down

0 comments on commit 0df00d9

Please sign in to comment.