From: Go MAEDA Date: Mon, 6 Feb 2023 13:50:33 +0000 (+0000) Subject: Fix RuboCop offense Performance/StringInclude (#37247). X-Git-Tag: 5.1.0~248 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=57e702a69ba58d7076325ae8670508a2f225de89;p=redmine.git Fix RuboCop offense Performance/StringInclude (#37247). git-svn-id: https://svn.redmine.org/redmine/trunk@22097 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/principal.rb b/app/models/principal.rb index 3c350d6a8..e62b5f320 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -179,7 +179,7 @@ class Principal < ActiveRecord::Base principal ||= principals.detect {|a| keyword.casecmp(a.login.to_s) == 0} principal ||= principals.detect {|a| keyword.casecmp(a.mail.to_s) == 0} - if principal.nil? && / /.match?(keyword) + if principal.nil? && keyword.include?(' ') firstname, lastname = *(keyword.split) # "First Last Throwaway" principal ||= principals.detect do |a|