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

@@ -137,7 +137,7 @@ module Redmine
revision = nil
parsing = nil
io.each_line do |line|
if line =~ /^----/
if /^----/.match?(line)
revisions << revision if revision
revision = Revision.new(:paths => [], :message => '')
parsing = nil
@@ -152,7 +152,7 @@ module Redmine
revision.scmid = $1.strip
elsif line =~ /^timestamp: (.+)$/
revision.time = Time.parse($1).localtime
elsif line =~ /^ -----/
elsif /^ -----/.match?(line)
# partial revisions
parsing = nil unless parsing == 'message'
elsif line =~ /^(message|added|modified|removed|renamed):/

View File

@@ -198,10 +198,10 @@ module Redmine
next
end
elsif state == "tags"
if /^#{STARTLOG}/ =~ line
if /^#{STARTLOG}/.match?(line)
commit_log = ""
state = "revision"
elsif /^#{ENDLOG}/ =~ line
elsif /^#{ENDLOG}/.match?(line)
state = "head"
end
next
@@ -232,13 +232,13 @@ module Redmine
end
commit_log = ""
revision = nil
if /^#{ENDLOG}/ =~ line
if /^#{ENDLOG}/.match?(line)
state = "entry_start"
end
next
end
if /^branches: (.+)$/ =~ line
if /^branches: (.+)$/.match?(line)
# TODO: version.branch = $1
elsif /^revision (\d+(?:\.\d+)+).*$/ =~ line
revision = $1
@@ -260,7 +260,7 @@ module Redmine
# version.line_minus = 0
# end
else
commit_log += line unless line =~ /^\*\*\* empty log message \*\*\*/
commit_log += line unless /^\*\*\* empty log message \*\*\*/.match?(line)
end
end
end

View File

@@ -636,7 +636,7 @@ class RedCloth3 < String
end
def lT( text )
text =~ /\#$/ ? 'o' : 'u'
/\#$/.match?(text) ? 'o' : 'u'
end
def hard_break( text )
@@ -908,7 +908,7 @@ class RedCloth3 < String
def refs( text )
@rules.each do |rule_name|
method( rule_name ).call( text ) if rule_name.to_s.match /^refs_/
method( rule_name ).call( text ) if rule_name.to_s.match? /^refs_/
end
end
@@ -1061,9 +1061,9 @@ class RedCloth3 < String
text.gsub!( ALLTAG_MATCH ) do |line|
## matches are off if we're between <code>, <pre> etc.
if $1
if line =~ OFFTAG_OPEN
if OFFTAG_OPEN.match?(line)
codepre += 1
elsif line =~ OFFTAG_CLOSE
elsif OFFTAG_CLOSE.match?(line)
codepre -= 1
codepre = 0 if codepre < 0
end