split off stemma analysis modules from base Tradition layer
[scpubgit/stemmatology.git] / base / 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};
fc7b6388 19 return $self->make_entry(
20 %args,
21 data => YAML::XS::Dump($object)
22 );
23 };
24}
25
26sub compile_expand {
27 my ( $self, $class ) = @_;
28
29 return sub {
30 my ( $self, $entry ) = @_;
f3f26624 31 $self->inflate_data( YAML::XS::Load($entry->data), \(my $obj), $entry );
fc7b6388 32 bless $obj, $class;
f3f26624 33 return $obj;
fc7b6388 34 };
35}
36
37sub compile_refresh { return sub { die "TODO" } }
38
39__PACKAGE__->meta->make_immutable;
40
411;