Class: GerritCodeChangeActivity
Instance Attribute Summary
#author, #code_change, #created_at, #id, #is_self, #message
Class Method Summary
collapse
Instance Method Summary
collapse
#notified, #should_notify?
Constructor Details
#initialize(id, author, is_self, message, created_at, code_change) ⇒ GerritCodeChangeActivity
Returns a new instance of GerritCodeChangeActivity.
10
11
12
13
14
15
16
17
|
# 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
|
Class Method Details
.translate_author(author) ⇒ Object
23
24
25
26
27
28
|
# 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) ⇒ Object
30
31
32
33
34
35
36
37
38
39
|
# 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
|
Instance Method Details
#messages_to_ignore ⇒ Object
19
20
21
|
# File 'lib/models/gerrit_code_change_activity.rb', line 19
def messages_to_ignore
[/Uploaded patch set 1/, /Build Started/, /owns \d+% of/]
end
|