diff options
author | Xavier Noria <fxn@hashref.com> | 2019-02-28 14:00:34 -0800 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2019-02-28 14:08:54 -0800 |
commit | 42ca13a9947a57e37b0498bc96da2b66ec14864e (patch) | |
tree | 494e60eb3b6c7833eb04e9d03a3dee713a761ebb | |
parent | 81710da41c2efac1d04868579d0b71f578f3f539 (diff) | |
download | rails-42ca13a9947a57e37b0498bc96da2b66ec14864e.tar.gz rails-42ca13a9947a57e37b0498bc96da2b66ec14864e.tar.bz2 rails-42ca13a9947a57e37b0498bc96da2b66ec14864e.zip |
Removes unnecessary dot in regexp
A string S matches ([.]|\b)html if an only if matches \bhtml:
* If S matches [.]html, then it matches \bhtml.
* If S matches \bhtml, then it matches \bhtml.
Reciprocally:
* If S matches \bhtml, then it matches ([.]|\b)html.
The character class can be removed, and since we are on it we remove the
group too so that it is clear to a reader of the code that there is no
grouping going on.
References #35166.
-rw-r--r-- | actionview/lib/action_view/helpers/translation_helper.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/translation_helper.rb b/actionview/lib/action_view/helpers/translation_helper.rb index 67c86592b9..8289c806ee 100644 --- a/actionview/lib/action_view/helpers/translation_helper.rb +++ b/actionview/lib/action_view/helpers/translation_helper.rb @@ -138,7 +138,7 @@ module ActionView end def html_safe_translation_key?(key) - /([_.]|\b)html\z/.match?(key.to_s) + /(?:_|\b)html\z/.match?(key.to_s) end end end |