aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2019-07-27 12:56:39 +0900
committerAkira Matsuda <ronnie@dio.jp>2019-07-27 13:06:49 +0900
commitd1ffe59ab5fd6e811833c127d43b32e87b5d7131 (patch)
treec866689e6b51b1f7eac9e49212d2938d56f6ecb2 /actionview
parente9651deea4145f62224af56af027bfbb3e45e4cd (diff)
downloadrails-d1ffe59ab5fd6e811833c127d43b32e87b5d7131.tar.gz
rails-d1ffe59ab5fd6e811833c127d43b32e87b5d7131.tar.bz2
rails-d1ffe59ab5fd6e811833c127d43b32e87b5d7131.zip
Use match? where we don't need MatchData
We're already running Performance/RegexpMatch cop, but it seems like the cop is not always =~ justice
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/helpers/url_helper.rb2
-rw-r--r--actionview/lib/action_view/layouts.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb
index 9b4116834e..ea2a97f458 100644
--- a/actionview/lib/action_view/helpers/url_helper.rb
+++ b/actionview/lib/action_view/helpers/url_helper.rb
@@ -689,7 +689,7 @@ module ActionView
end
def add_method_to_attributes!(html_options, method)
- if method_not_get_method?(method) && html_options["rel"] !~ /nofollow/
+ if method_not_get_method?(method) && !html_options["rel"]&.match?(/nofollow/)
if html_options["rel"].blank?
html_options["rel"] = "nofollow"
else
diff --git a/actionview/lib/action_view/layouts.rb b/actionview/lib/action_view/layouts.rb
index be21ff0e5d..74e8e80e07 100644
--- a/actionview/lib/action_view/layouts.rb
+++ b/actionview/lib/action_view/layouts.rb
@@ -395,7 +395,7 @@ module ActionView
end
def _normalize_layout(value)
- value.is_a?(String) && value !~ /\blayouts/ ? "layouts/#{value}" : value
+ value.is_a?(String) && !value.match?(/\blayouts/) ? "layouts/#{value}" : value
end
# Returns the default layout for this controller.