Merge branch 'master' of github.com:tla/stemmatology
[scpubgit/stemmatology.git] / lib / Text / Tradition.pm
index f0edbbe..8bed34d 100644 (file)
@@ -34,11 +34,17 @@ has 'name' => (
     default => 'Tradition',
     );
     
-has 'stemma' => (
-       is => 'ro',
-       isa => 'Text::Tradition::Stemma',
-       writer => '_add_stemma',
-       predicate => 'has_stemma',
+has 'stemmata' => (
+       traits => ['Array'],
+       isa => 'ArrayRef[Text::Tradition::Stemma]',
+       handles => {
+               all_stemmata => 'elements',
+               _add_stemma => 'push',
+               stemma => 'get',
+               stemma_count => 'count',
+               clear_stemmata => 'clear',
+       },
+       default => sub { [] },
        );
   
 # Create the witness before trying to add it
@@ -301,10 +307,12 @@ my $t = Text::Tradition->new(
     'file'  => 't/data/simple.txt',
     );
 
+is( $t->stemma_count, 0, "No stemmas added yet" );
 my $s;
-ok( $s = $t->add_stemma( 't/data/simple.dot' ), "Added a simple stemma" );
+ok( $s = $t->add_stemma( dotfile => 't/data/simple.dot' ), "Added a simple stemma" );
 is( ref( $s ), 'Text::Tradition::Stemma', "Got a stemma object returned" );
-is( $t->stemma, $s, "Stemma is the right one" );
+is( $t->stemma_count, 1, "Tradition claims to have a stemma" );
+is( $t->stemma(0), $s, "Tradition hands back the right stemma" );
 
 =end testing