File: LinkResolver.pm

package info (click to toggle)
libtext-trac-perl 0.24-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 712 kB
  • sloc: perl: 1,462; makefile: 10
file content (29 lines) | stat: -rwxr-xr-x 645 bytes parent folder | download | duplicates (2)
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.24';

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;