From 52a873a09dc9f938457f3be854c0514351e91d17 Mon Sep 17 00:00:00 2001 From: Erik Berlin Date: Mon, 1 May 2023 15:07:34 -0700 Subject: [PATCH] Use match? instead of =~ when MatchData is not used --- lib/t/cli.rb | 2 +- lib/t/editor.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/t/cli.rb b/lib/t/cli.rb index 65a50b0c..664bb47e 100644 --- a/lib/t/cli.rb +++ b/lib/t/cli.rb @@ -966,7 +966,7 @@ def extract_mentioned_screen_names(text) ([a-zA-Z0-9_]{1,20}) # $3: Screen name /ox - return [] if text !~ at_signs + return [] if !text&.match?(at_signs) text.to_s.scan(valid_mentions).collect do |_, _, screen_name| screen_name diff --git a/lib/t/editor.rb b/lib/t/editor.rb index c7f5cc1e..bb3512a2 100644 --- a/lib/t/editor.rb +++ b/lib/t/editor.rb @@ -26,7 +26,7 @@ def editor end def system_editor - RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ ? "notepad" : "vi" + /mswin|mingw/.match?(RbConfig::CONFIG["host_os"]) ? "notepad" : "vi" end end end