Class: Ducalis::Commentators::Github
- Inherits:
-
Object
- Object
- Ducalis::Commentators::Github
- Defined in:
- lib/ducalis/commentators/github.rb
Constant Summary collapse
- STATUS =
'COMMENT'.freeze
- SIMILARITY_THRESHOLD =
0.8
Instance Method Summary collapse
- #call(offenses) ⇒ Object
-
#initialize(repo, id) ⇒ Github
constructor
A new instance of Github.
Constructor Details
#initialize(repo, id) ⇒ Github
Returns a new instance of Github.
9 10 11 12 |
# File 'lib/ducalis/commentators/github.rb', line 9 def initialize(repo, id) @repo = repo @id = id end |
Instance Method Details
#call(offenses) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ducalis/commentators/github.rb', line 14 def call(offenses) comments = offenses.reject { |offense| already_commented?(offense) } .map { |offense| present_offense(offense) } return if comments.empty? Utils.octokit .create_pull_request_review(@repo, @id, event: STATUS, comments: comments) end |