X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FLaTeX%2FTikZ%2FSet%2FSequence.pm;h=afdc313813eaf7fea53e563d86db6b898a02f75c;hb=33b0a6db16fd5b70df1c151ff720bd07fbf34bdd;hp=a92ad89d7dd93e267870cefa4a046047575688c9;hpb=92147217516a40b35ca00c8e08939e8aa5478426;p=perl%2Fmodules%2FLaTeX-TikZ.git diff --git a/lib/LaTeX/TikZ/Set/Sequence.pm b/lib/LaTeX/TikZ/Set/Sequence.pm index a92ad89..afdc313 100644 --- a/lib/LaTeX/TikZ/Set/Sequence.pm +++ b/lib/LaTeX/TikZ/Set/Sequence.pm @@ -9,22 +9,29 @@ LaTeX::TikZ::Set::Sequence - A set object grouping a sequence of objects. =head1 VERSION -Version 0.01 +Version 0.02 =cut -our $VERSION = '0.01'; +our $VERSION = '0.02'; use List::Util (); use LaTeX::TikZ::Scope; +use LaTeX::TikZ::Interface; use LaTeX::TikZ::Functor; use Any::Moose; use Any::Moose 'Util::TypeConstraints' => [ qw/subtype as where find_type_constraint/ ]; +=head1 RELATIONSHIPS + +This class consumes the L and L roles, and as such implements the L and L methods. + +=cut + with qw( LaTeX::TikZ::Set LaTeX::TikZ::Set::Mutable @@ -37,6 +44,14 @@ subtype 'LaTeX::TikZ::Set::Sequence::Elements' or $_->isa('LaTeX::TikZ::Set::Sequence') }; +=head1 ATTRIBUTES + +=head2 C + +The L or L objects that from the sequence. + +=cut + has '_kids' => ( is => 'ro', isa => 'Maybe[ArrayRef[LaTeX::TikZ::Set::Sequence::Elements]]', @@ -46,6 +61,12 @@ has '_kids' => ( sub kids { @{$_[0]->_kids} } +=head1 METHODS + +=head2 C + +=cut + my $ltsse_tc = find_type_constraint('LaTeX::TikZ::Set::Sequence::Elements'); sub add { @@ -58,19 +79,28 @@ sub add { $set; } +=head2 C + +=cut + sub draw { my $set = shift; + my @kids = $set->kids; + return [ ] unless @kids; + List::Util::reduce { LaTeX::TikZ::Scope::fold($a, $b) } map $_->draw(@_), - $set->kids; + @kids; } -use LaTeX::TikZ::Interface seq => sub { - shift; +LaTeX::TikZ::Interface->register( + seq => sub { + shift; - __PACKAGE__->new(kids => \@_); -}; + __PACKAGE__->new(kids => \@_); + }, +); LaTeX::TikZ::Functor->default_rule( (__PACKAGE__) => sub { @@ -81,6 +111,10 @@ LaTeX::TikZ::Functor->default_rule( __PACKAGE__->meta->make_immutable; +=head1 SEE ALSO + +L, L, L. + =head1 AUTHOR Vincent Pit, C<< >>, L.