" WHERE #{Journal.table_name}.journalized_type='Issue' AND #{Journal.table_name}.journalized_id=#{Issue.table_name}.id" +
" AND (#{sql_for_field field, operator.delete_prefix('!'), value, Journal.table_name, 'notes'})" +
" AND (#{Journal.visible_notes_condition(User.current, :skip_pre_condition => true)})"
- "#{/^!/.match?(operator) ? "NOT EXISTS" : "EXISTS"} (#{subquery})"
+ "#{operator.start_with?('!') ? "NOT EXISTS" : "EXISTS"} (#{subquery})"
end
def sql_for_updated_by_field(field, operator, value)
def target(path, sq=true)
path ||= ''
- base = /^\//.match?(path) ? root_url : url
+ base = path.start_with?('/') ? root_url : url
str = "#{base}/#{path}".gsub(/[?<>\*]/, '')
if sq
str = shell_quote(str)
revision = nil
parsing = nil
io.each_line do |line|
- if /^----/.match?(line)
+ if line.start_with?('----')
revisions << revision if revision
revision = Revision.new(:paths => [], :message => '')
parsing = nil
revision.scmid = $1.strip
elsif line =~ /^timestamp: (.+)$/
revision.time = Time.parse($1).localtime
- elsif /^ -----/.match?(line)
+ elsif line.start_with?(' -----')
# partial revisions
parsing = nil unless parsing == 'message'
elsif line =~ /^(message|added|modified|removed|renamed):/
file_state = nil
branch_map = nil
io.each_line() do |line|
- if state != "revision" && /^#{ENDLOG}/o.match?(line)
+ if state != "revision" && line.start_with?(ENDLOG)
commit_log = ""
revision = nil
state = "entry_start"
logger.debug("Path #{entry_path} <=> Name #{entry_name}")
elsif /^head: (.+)$/ =~ line
entry_headRev = $1
- elsif /^symbolic names:/.match?(line)
+ elsif line.start_with?('symbolic names:')
state = "symbolic"
- elsif /^#{STARTLOG}/o.match?(line)
+ elsif line.start_with?(STARTLOG)
commit_log = ""
state = "revision"
end
next
end
elsif state == "tags"
- if /^#{STARTLOG}/o.match?(line)
+ if line.start_with?(STARTLOG)
commit_log = ""
state = "revision"
- elsif /^#{ENDLOG}/o.match?(line)
+ elsif line.start_with?(ENDLOG)
state = "head"
end
next
elsif state == "revision"
- if /^#{ENDLOG}/o =~ line || /^#{STARTLOG}/o =~ line
+ if line.start_with?(ENDLOG, STARTLOG)
if revision
revHelper = CvsRevisionHelper.new(revision)
revBranch = "HEAD"
end
commit_log = ""
revision = nil
- if /^#{ENDLOG}/o.match?(line)
+ if line.start_with?(ENDLOG)
state = "entry_start"
end
next
# version.line_minus = 0
# end
else
- commit_log += line unless /^\*\*\* empty log message \*\*\*/.match?(line)
+ commit_log += line unless line.start_with?('*** empty log message ***')
end
end
end
end
def target(path = '')
- base = /^\//.match?(path) ? root_url : url
+ base = path.start_with?('/') ? root_url : url
uri = "#{base}/#{path}"
uri = Addressable::URI.encode(uri)
shell_quote(uri.gsub(/[?<>\*]/, ''))
# the regexp prevents wiki links with a | from being cut as cells
row.scan(/\|(_?#{S}#{A}#{C}\. ?)?((\[\[[^|\]]*\|[^|\]]*\]\]|[^|])*?)(?=\|)/o) do |modifiers, cell|
ctyp = 'd'
- ctyp = 'h' if modifiers && modifiers =~ /^_/
+ ctyp = 'h' if modifiers&.start_with?('_')
catts = nil
catts = pba( modifiers, 'td' ) if modifiers
end
def lT( text )
- /\#$/.match?(text) ? 'o' : 'u'
+ text.end_with?('#') ? 'o' : 'u'
end
def hard_break( text )
block_applied = 0
@rules.each do |rule_name|
- block_applied += 1 if rule_name.to_s.match /^block_/ and method(rule_name).call(blk)
+ block_applied += 1 if rule_name.to_s.start_with?('block_') and method(rule_name).call(blk)
end
if block_applied.zero?
if deep_code
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.start_with?('refs_')
end
end
missing_keys.each do |key|
{key => en_strings[key]}.to_yaml.each_line do |line|
- next if line =~ /^---/ || line.empty?
+ next if line.start_with?('---') || line.empty?
puts " #{line}"
lang << " #{line}"
end
File.open(path, 'a') do |file|
adds.each do |kv|
Hash[*kv].to_yaml.each_line do |line|
- file.puts " #{line}" unless (line =~ /^---/ || line.empty?)
+ file.puts " #{line}" unless (line.start_with?('---') || line.empty?)
end
end
end