Class: Codebot::Formatters::PullRequestReviewComment

Inherits:
Codebot::Formatter show all
Defined in:
lib/codebot/formatters/pull_request_review_comment.rb

Overview

This class formats pull_request_review_comment events.

Instance Attribute Summary

Attributes inherited from Codebot::Formatter

#payload

Instance Method Summary collapse

Methods inherited from Codebot::Formatter

#abbreviate, #action, #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

Constructor Details

This class inherits a constructor from Codebot::Formatter

Instance Method Details

#comment_bodyObject



36
37
38
# File 'lib/codebot/formatters/pull_request_review_comment.rb', line 36

def comment_body
  extract(:comment, :body)
end

#commit_idObject



40
41
42
# File 'lib/codebot/formatters/pull_request_review_comment.rb', line 40

def commit_id
  extract(:comment, :commit_id)
end

#default_formatObject



27
28
29
30
# File 'lib/codebot/formatters/pull_request_review_comment.rb', line 27

def default_format
  '[%<repository>s] %<sender>s commented on pull request #%<number>s ' \
  '%<hash>s: %<summary>s'
end

#formatArray<String>

Formats IRC messages for a pull_request_review_comment event.

Returns:

  • (Array<String>)

    the formatted messages



13
14
15
# File 'lib/codebot/formatters/pull_request_review_comment.rb', line 13

def format
  ["#{summary}: #{format_url url}"]
end

#pull_numberObject



44
45
46
# File 'lib/codebot/formatters/pull_request_review_comment.rb', line 44

def pull_number
  extract(:pull_request, :number)
end

#summaryObject



17
18
19
20
21
22
23
24
25
# File 'lib/codebot/formatters/pull_request_review_comment.rb', line 17

def summary
  default_format % {
    repository: format_repository(repository_name),
    sender: format_user(sender_name),
    number: pull_number,
    hash: format_hash(commit_id),
    short: prettify(comment_body)
  }
end

#summary_urlObject



32
33
34
# File 'lib/codebot/formatters/pull_request_review_comment.rb', line 32

def summary_url
  extract(:comment, :html_url).to_s
end