Class: Codebot::Formatters::Watch
Overview
This class formats watch events.
Instance Attribute Summary
#payload
Instance Method Summary
collapse
#abbreviate, #ary_to_sentence, #closed?, #extract, #format_branch, #format_dangerous, #format_event, #format_hash, #format_number, #format_repository, #format_url, #format_user, #gitlab_action, #gitlab_closed?, #gitlab_opened?, #gitlab_repository_url, #gitlab_url, #initialize, #opened?, #prettify, #repository_name, #repository_url, #sanitize, #sender_name, #shorten_url, #url
Instance Method Details
#action ⇒ Object
25
26
27
|
# File 'lib/codebot/formatters/watch.rb', line 25
def action
(:action)
end
|
21
22
23
|
# File 'lib/codebot/formatters/watch.rb', line 21
def default_format
'[%<repository>s] %<sender>s starred the repository'
end
|
Formats IRC messages for a watch event.
10
11
12
|
# File 'lib/codebot/formatters/watch.rb', line 10
def format
["#{summary}: #{format_url url}"] if started?
end
|
#started? ⇒ Boolean
29
30
31
|
# File 'lib/codebot/formatters/watch.rb', line 29
def started?
action.eql? 'started'
end
|
#summary ⇒ Object
14
15
16
17
18
19
|
# File 'lib/codebot/formatters/watch.rb', line 14
def summary
default_format % {
repository: format_repository(repository_name),
sender: format_user(sender_name)
}
end
|
#summary_url ⇒ Object
33
34
35
|
# File 'lib/codebot/formatters/watch.rb', line 33
def summary_url
"#{repository_url}/stargazers"
end
|