summaryrefslogtreecommitdiffstats
path: root/lib/Bot/Games/Trait/Method/Formatted.pm
blob: 7e0b986c3c04b73e5718f40ab8cb8c419898b7a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package Bot::Games::Trait::Method::Formatted;
use Moose::Role;

has formatter => (
    is      => 'rw',
    isa     => 'CodeRef',
    default => sub { sub {
        warn "no formatter specified!";
        return @_;
    } },
);

sub _munge_formatter {
    my $self = shift;
    my ($format) = @_;
    return $format if ref($format) eq 'CODE';
    return $self->associated_metaclass->formatter_for($format);
}

no Moose::Role;

1;