Patch #34150 » use-match.diff
app/models/issue_import.rb (作業コピー) | ||
---|---|---|
179 | 179 |
else |
180 | 180 |
add_callback(parent_issue_id, 'set_as_parent', item.position) |
181 | 181 |
end |
182 |
elsif parent_issue_id =~ /\A\d+\z/
|
|
182 |
elsif /\A\d+\z/.match?(parent_issue_id)
|
|
183 | 183 |
# refers to other row by position |
184 | 184 |
parent_issue_id = parent_issue_id.to_i |
185 | 185 |
app/models/setting.rb (作業コピー) | ||
---|---|---|
186 | 186 |
if settings.key?(:mail_from) |
187 | 187 |
begin |
188 | 188 |
mail_from = Mail::Address.new(settings[:mail_from]) |
189 |
raise unless mail_from.address =~ EmailAddress::EMAIL_REGEXP
|
|
189 |
raise unless EmailAddress::EMAIL_REGEXP.match?(mail_from.address)
|
|
190 | 190 |
rescue |
191 | 191 |
messages << [:mail_from, l('activerecord.errors.messages.invalid')] |
192 | 192 |
end |
db/migrate/20120422150750_change_repositories_to_full_sti.rb (作業コピー) | ||
---|---|---|
3 | 3 |
Repository.connection. |
4 | 4 |
select_rows("SELECT id, type FROM #{Repository.table_name}"). |
5 | 5 |
each do |repository_id, repository_type| |
6 |
unless repository_type =~ /^Repository::/
|
|
6 |
unless /^Repository::/.match?(repository_type)
|
|
7 | 7 |
Repository.where(["id = ?", repository_id]). |
8 | 8 |
update_all(["type = ?", "Repository::#{repository_type}"]) |
9 | 9 |
end |
db/migrate/20180923082945_change_sqlite_booleans_to_0_and_1.rb (作業コピー) | ||
---|---|---|
23 | 23 |
} |
24 | 24 | |
25 | 25 |
def up |
26 |
if ActiveRecord::Base.connection.adapter_name =~ /sqlite/i
|
|
26 |
if /sqlite/i.match?(ActiveRecord::Base.connection.adapter_name)
|
|
27 | 27 |
COLUMNS.each do |klass, columns| |
28 | 28 |
columns.each do |column| |
29 | 29 |
klass.where("#{column} = 't'").update_all(column => 1) |
... | ... | |
34 | 34 |
end |
35 | 35 | |
36 | 36 |
def down |
37 |
if ActiveRecord::Base.connection.adapter_name =~ /sqlite/i
|
|
37 |
if /sqlite/i.match?(ActiveRecord::Base.connection.adapter_name)
|
|
38 | 38 |
COLUMNS.each do |klass, columns| |
39 | 39 |
columns.each do |column| |
40 | 40 |
klass.where("#{column} = 1").update_all(column => 't') |
db/migrate/20180923091603_change_sqlite_booleans_default.rb (作業コピー) | ||
---|---|---|
74 | 74 |
} |
75 | 75 | |
76 | 76 |
def up |
77 |
if ActiveRecord::Base.connection.adapter_name =~ /sqlite/i
|
|
77 |
if /sqlite/i.match?(ActiveRecord::Base.connection.adapter_name)
|
|
78 | 78 |
DEFAULTS.each do |table, defaults| |
79 | 79 |
defaults.each do |column, value| |
80 | 80 |
# Reset default values for boolean column (t/f => 1/0) |
... | ... | |
85 | 85 |
end |
86 | 86 | |
87 | 87 |
def down |
88 |
if ActiveRecord::Base.connection.adapter_name =~ /sqlite/i
|
|
88 |
if /sqlite/i.match?(ActiveRecord::Base.connection.adapter_name)
|
|
89 | 89 |
# Cannot restore default values as t/f |
90 | 90 |
raise ActiveRecord::IrreversibleMigration |
91 | 91 |
end |
lib/redmine/scm/adapters/bazaar_adapter.rb (作業コピー) | ||
---|---|---|
137 | 137 |
revision = nil |
138 | 138 |
parsing = nil |
139 | 139 |
io.each_line do |line| |
140 |
if line =~ /^----/
|
|
140 |
if /^----/.match?(line)
|
|
141 | 141 |
revisions << revision if revision |
142 | 142 |
revision = Revision.new(:paths => [], :message => '') |
143 | 143 |
parsing = nil |
... | ... | |
152 | 152 |
revision.scmid = $1.strip |
153 | 153 |
elsif line =~ /^timestamp: (.+)$/ |
154 | 154 |
revision.time = Time.parse($1).localtime |
155 |
elsif line =~ /^ -----/
|
|
155 |
elsif /^ -----/.match?(line)
|
|
156 | 156 |
# partial revisions |
157 | 157 |
parsing = nil unless parsing == 'message' |
158 | 158 |
elsif line =~ /^(message|added|modified|removed|renamed):/ |
lib/redmine/scm/adapters/cvs_adapter.rb (作業コピー) | ||
---|---|---|
198 | 198 |
next |
199 | 199 |
end |
200 | 200 |
elsif state == "tags" |
201 |
if /^#{STARTLOG}/ =~ line
|
|
201 |
if /^#{STARTLOG}/.match?(line)
|
|
202 | 202 |
commit_log = "" |
203 | 203 |
state = "revision" |
204 |
elsif /^#{ENDLOG}/ =~ line
|
|
204 |
elsif /^#{ENDLOG}/.match?(line)
|
|
205 | 205 |
state = "head" |
206 | 206 |
end |
207 | 207 |
next |
... | ... | |
232 | 232 |
end |
233 | 233 |
commit_log = "" |
234 | 234 |
revision = nil |
235 |
if /^#{ENDLOG}/ =~ line
|
|
235 |
if /^#{ENDLOG}/.match?(line)
|
|
236 | 236 |
state = "entry_start" |
237 | 237 |
end |
238 | 238 |
next |
239 | 239 |
end |
240 | 240 | |
241 |
if /^branches: (.+)$/ =~ line
|
|
241 |
if /^branches: (.+)$/.match?(line)
|
|
242 | 242 |
# TODO: version.branch = $1 |
243 | 243 |
elsif /^revision (\d+(?:\.\d+)+).*$/ =~ line |
244 | 244 |
revision = $1 |
... | ... | |
260 | 260 |
# version.line_minus = 0 |
261 | 261 |
# end |
262 | 262 |
else |
263 |
commit_log += line unless line =~ /^\*\*\* empty log message \*\*\*/
|
|
263 |
commit_log += line unless /^\*\*\* empty log message \*\*\*/.match?(line)
|
|
264 | 264 |
end |
265 | 265 |
end |
266 | 266 |
end |
lib/redmine/wiki_formatting/textile/redcloth3.rb (作業コピー) | ||
---|---|---|
636 | 636 |
end |
637 | 637 | |
638 | 638 |
def lT( text ) |
639 |
text =~ /\#$/ ? 'o' : 'u'
|
|
639 |
/\#$/.match?(text) ? 'o' : 'u'
|
|
640 | 640 |
end |
641 | 641 | |
642 | 642 |
def hard_break( text ) |
... | ... | |
908 | 908 | |
909 | 909 |
def refs( text ) |
910 | 910 |
@rules.each do |rule_name| |
911 |
method( rule_name ).call( text ) if rule_name.to_s.match /^refs_/ |
|
911 |
method( rule_name ).call( text ) if rule_name.to_s.match? /^refs_/
|
|
912 | 912 |
end |
913 | 913 |
end |
914 | 914 | |
... | ... | |
1061 | 1061 |
text.gsub!( ALLTAG_MATCH ) do |line| |
1062 | 1062 |
## matches are off if we're between <code>, <pre> etc. |
1063 | 1063 |
if $1 |
1064 |
if line =~ OFFTAG_OPEN
|
|
1064 |
if OFFTAG_OPEN.match?(line)
|
|
1065 | 1065 |
codepre += 1 |
1066 |
elsif line =~ OFFTAG_CLOSE
|
|
1066 |
elsif OFFTAG_CLOSE.match?(line)
|
|
1067 | 1067 |
codepre -= 1 |
1068 | 1068 |
codepre = 0 if codepre < 0 |
1069 | 1069 |
end |