class GerritCodeChangeActivity

Public Class Methods

new(id, author, is_self, message, created_at, code_change) click to toggle source
# File lib/models/gerrit_code_change_activity.rb, line 10
def initialize(id, author, is_self, message, created_at, code_change)
  @id = id
  @author = CodeChangeActivity.translate_author(author)
  @is_self = is_self
  @message = CodeChangeActivity.translate_message(message)
  @created_at = created_at
  @code_change = code_change
end
translate_author(author) click to toggle source
# File lib/models/gerrit_code_change_activity.rb, line 23
def self.translate_author(author)
  AUTHOR_TRANSLATIONS.keys.each do |pattern|
    author.sub!(pattern, AUTHOR_TRANSLATIONS[pattern])
  end
  author
end
translate_message(message) click to toggle source
# File lib/models/gerrit_code_change_activity.rb, line 30
def self.translate_message(message)
  message.sub(/^Patch Set \d+:\s+/, "")
         .gsub("'", %q(\\\\\\\\'))
         .gsub("\n", " ")
         .gsub("  ", " ")
         .gsub(">", "")
         .sub(/^\(/, "\\(")
         .sub(/^\[/, "\\[")
         .sub(/^-/, "\\-")
end

Public Instance Methods

messages_to_ignore() click to toggle source
# File lib/models/gerrit_code_change_activity.rb, line 19
def messages_to_ignore
  [/Uploaded patch set 1/, /Build Started/, /owns \d+% of/]
end