File Coverage

blib/lib/App/GitHubWebhooks2Ikachan/Events/PullRequestReviewComment.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 25 26 96.1


line stmt bran cond sub pod time code
1             package App::GitHubWebhooks2Ikachan::Events::PullRequestReviewComment;
2 1     1   5 use strict;
  1         2  
  1         37  
3 1     1   4 use warnings;
  1         3  
  1         29  
4 1     1   5 use utf8;
  1         1  
  1         8  
5 1     1   919 use String::IRC;
  1         998  
  1         222  
6              
7             sub call {
8 1     1 0 2 my ($class, $context) = @_;
9              
10 1         7 my $comment = $context->dat->{comment};
11              
12 1         13 (my $comment_body = $comment->{body}) =~ s/\r?\n.*//g;
13 1         3 my $user_name = $comment->{user}->{login};
14 1         3 my $url = $comment->{html_url};
15              
16 1         8 my ($pull_request_number) = $comment->{pull_request_url} =~ m!/(\d+)\Z!;
17              
18 1         5 my $main_text = "[review comment (#$pull_request_number)] $comment_body (\@$user_name)";
19 1         3 return String::IRC->new($main_text)->green . " $url";
20             }
21              
22             1;
23