Use match? instead of =~ when MatchData is not used (#34150).

Patch by Go MAEDA.


git-svn-id: http://svn.redmine.org/redmine/trunk@20168 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2020-10-23 00:13:38 +00:00
parent 5280861cf3
commit fdba424d77
8 changed files with 18 additions and 18 deletions

View File

@@ -179,7 +179,7 @@ class IssueImport < Import
else
add_callback(parent_issue_id, 'set_as_parent', item.position)
end
elsif parent_issue_id =~ /\A\d+\z/
elsif /\A\d+\z/.match?(parent_issue_id)
# refers to other row by position
parent_issue_id = parent_issue_id.to_i

View File

@@ -186,7 +186,7 @@ class Setting < ActiveRecord::Base
if settings.key?(:mail_from)
begin
mail_from = Mail::Address.new(settings[:mail_from])
raise unless mail_from.address =~ EmailAddress::EMAIL_REGEXP
raise unless EmailAddress::EMAIL_REGEXP.match?(mail_from.address)
rescue
messages << [:mail_from, l('activerecord.errors.messages.invalid')]
end