merge performance branch into main
[scpubgit/stemmatology.git] / lib / Text / Tradition / TypeMap / Entry.pm
CommitLineData
fc7b6388 1package Text::Tradition::TypeMap::Entry;
2use Moose;
3
4no warnings 'recursion';
5
6use namespace::clean -except => 'meta';
7
8with qw(KiokuDB::TypeMap::Entry::Std);
9
10use YAML::XS ();
11
12sub compile_collapse_body {
13 my ( $self, $class ) = @_;
14
15 return sub {
16 my ( $self, %args ) = @_;
17
18 my $object = $args{object};
19
20 return $self->make_entry(
21 %args,
22 data => YAML::XS::Dump($object)
23 );
24 };
25}
26
27sub compile_expand {
28 my ( $self, $class ) = @_;
29
30 return sub {
31 my ( $self, $entry ) = @_;
32 $self->inflate_data( YAML::XS::Load($entry->data), \( my $obj ), $entry );
33
34 bless $obj, $class;
35 };
36}
37
38sub compile_refresh { return sub { die "TODO" } }
39
40__PACKAGE__->meta->make_immutable;
41
421;