File: LinkResolver.pm

package info (click to toggle)
libtext-trac-perl 0.16-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 364 kB
  • ctags: 257
  • sloc: perl: 2,971; makefile: 2
file content (29 lines) | stat: -rwxr-xr-x 681 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package Text::Trac::LinkResolver;

use strict;
use warnings;
use List::MoreUtils qw( any );

our $VERSION = '0.16';

our @handlers = qw( changeset wiki report log ticket milestone source attachment comment );

sub new {
    my $class = shift;
    my $self = { context => shift };
    bless $self, $class;
    $self->init;
    return $self;
}

sub _is_disabled {
    my ( $self, $resolver ) = @_;
    ( my $formatter = ref $self ) =~ s/.*:://;

    if ( @{ $self->{context}->{enable_links} } ) {
        return !any { lcfirst($formatter) eq $_ } @{ $self->{context}->{enable_links} };
    }

    return any { lcfirst($formatter) eq $_ } @{ $self->{context}->{disable_links} };
}
1;