blob: 6c3092a844c127a00ca77890b842ecd31790bfa0 (
plain) (
blame)
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
|
package Bot::Games::Trait::Class::Formatted;
use Bot::Games::OO::Role;
has default_formatters => (
metaclass => 'Collection::ImmutableHash',
is => 'ro',
isa => 'HashRef[CodeRef]',
builder => '_build_default_formatters',
provides => {
get => 'formatter_for',
exists => 'has_formatter',
keys => 'formattable_tcs',
},
);
sub _build_default_formatters {
{
'ArrayRef' => sub { join ', ', @{ shift() } },
'Bool' => sub { return shift() ? 'true' : 'false' },
'Object' => sub { shift() . "" },
}
}
no Bot::Games::OO::Role;
1;
|