aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuhiro NISHIYAMA <zn@mbf.nifty.com>2019-02-05 23:23:22 +0900
committerKazuhiro NISHIYAMA <zn@mbf.nifty.com>2019-02-05 23:23:22 +0900
commit30a08a898862a67502e58074ffaa8cc2338840f5 (patch)
tree796763e917905ad87f84bc2fe67ea210c2cbea02
parenteec3e28a1abf75676dcee58308ee5721bb53c325 (diff)
downloadrails-30a08a898862a67502e58074ffaa8cc2338840f5.tar.gz
rails-30a08a898862a67502e58074ffaa8cc2338840f5.tar.bz2
rails-30a08a898862a67502e58074ffaa8cc2338840f5.zip
Improve regexp of `html_safe_translation_key?`
- Use `\z` instead of `$` - Use character class instead of alternation - Optimize alternation order
-rw-r--r--actionview/lib/action_view/helpers/translation_helper.rb2
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 ae1c93e12f..67c86592b9 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$/.match?(key.to_s)
+ /([_.]|\b)html\z/.match?(key.to_s)
end
end
end