Class: Linterbot::ResultHandler
- Inherits:
-
Object
- Object
- Linterbot::ResultHandler
- Defined in:
- lib/linterbot/result_handler.rb
Instance Attribute Summary collapse
-
#approver ⇒ Object
Returns the value of attribute approver.
-
#commenter ⇒ Object
Returns the value of attribute commenter.
-
#github_client ⇒ Object
Returns the value of attribute github_client.
-
#pull_request ⇒ Object
Returns the value of attribute pull_request.
Instance Method Summary collapse
- #handle(result) ⇒ Object
-
#initialize(pull_request, commenter, approver) ⇒ ResultHandler
constructor
A new instance of ResultHandler.
Constructor Details
#initialize(pull_request, commenter, approver) ⇒ ResultHandler
Returns a new instance of ResultHandler.
10 11 12 13 14 |
# File 'lib/linterbot/result_handler.rb', line 10 def initialize(pull_request, commenter, approver) @pull_request = pull_request @commenter = commenter @approver = approver end |
Instance Attribute Details
#approver ⇒ Object
Returns the value of attribute approver.
8 9 10 |
# File 'lib/linterbot/result_handler.rb', line 8 def approver @approver end |
#commenter ⇒ Object
Returns the value of attribute commenter.
7 8 9 |
# File 'lib/linterbot/result_handler.rb', line 7 def commenter @commenter end |
#github_client ⇒ Object
Returns the value of attribute github_client.
6 7 8 |
# File 'lib/linterbot/result_handler.rb', line 6 def github_client @github_client end |
#pull_request ⇒ Object
Returns the value of attribute pull_request.
5 6 7 |
# File 'lib/linterbot/result_handler.rb', line 5 def pull_request @pull_request end |
Instance Method Details
#handle(result) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/linterbot/result_handler.rb', line 16 def handle(result) result.comments.each { |comment| commenter.publish_comment(comment) } commenter.publish_summary(result.summary) if result.serious_violations? reject_pull_request(result.serious_violations_count) else approve_pull_request end end |