File Coverage

blib/lib/Text/Trac/LinkResolver/Milestone.pm
Criterion Covered Total %
statement 18 18 100.0
branch 3 4 75.0
condition 3 6 50.0
subroutine 5 5 100.0
pod 0 2 0.0
total 29 35 82.8


line stmt bran cond sub pod time code
1             package Text::Trac::LinkResolver::Milestone;
2              
3 8     8   44 use strict;
  8         15  
  8         188  
4 8     8   34 use warnings;
  8         15  
  8         174  
5 8     8   32 use base qw( Text::Trac::LinkResolver );
  8         13  
  8         31  
6              
7             our $VERSION = '0.24';
8              
9             sub init {
10 1607     1607 0 2496 my $self = shift;
11             }
12              
13             sub format_link {
14 6     6 0 20 my ( $self, $match, $target, $label ) = @_;
15 6 100       39 return $match if $self->_is_disabled;
16              
17 5         20 my $c = $self->{context};
18 5   33     15 $label ||= $match;
19 5         19 my ( $from, $to ) = ( $match =~ m/(\d+):(\d+)/ );
20              
21 5   66     95 my $url = $c->{trac_milestone_url} || $c->trac_url . 'milestone/';
22 5         35 $url .= $target;
23              
24 5 50       67 return sprintf '%s', ( $c->{class} ? q{class="milestone"} : '' ), $url, $label;
25             }
26              
27             1;