X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FLaTeX%2FTikZ%2FScope.pm;h=d8ce86183abfde264ab100125983fc7873a3b34e;hb=1ace068a681d0dea45c546bb6509586212adec98;hp=3686beb28b5e7f73d4b5302524f41b8d317b7fb8;hpb=a2871e9a7be49f59dab5d64afab543404b1e13f4;p=perl%2Fmodules%2FLaTeX-TikZ.git diff --git a/lib/LaTeX/TikZ/Scope.pm b/lib/LaTeX/TikZ/Scope.pm index 3686beb..d8ce861 100644 --- a/lib/LaTeX/TikZ/Scope.pm +++ b/lib/LaTeX/TikZ/Scope.pm @@ -9,11 +9,11 @@ LaTeX::TikZ::Scope - An object modeling a TikZ scope or layer. =head1 VERSION -Version 0.01 +Version 0.02 =cut -our $VERSION = '0.01'; +our $VERSION = '0.02'; use Sub::Name (); @@ -21,6 +21,12 @@ use LaTeX::TikZ::Tools; use Any::Moose; +=head1 ATTRIBUTES + +=head2 C + +=cut + has '_mods' => ( is => 'ro', isa => 'Maybe[ArrayRef[LaTeX::TikZ::Mod::Formatted]]', @@ -37,6 +43,10 @@ has '_mods_cache' => ( default => sub { +{ } }, ); +=head2 C + +=cut + has '_body' => ( is => 'rw', isa => 'LaTeX::TikZ::Scope|ArrayRef[Str]', @@ -48,6 +58,12 @@ my $ltmf_tc = LaTeX::TikZ::Tools::type_constraint('LaTeX::TikZ::Mod::Formatted' my $_body_tc = __PACKAGE__->meta->find_attribute_by_name('_body') ->type_constraint; +=head1 METHODS + +=head2 C + +=cut + sub mod { my $scope = shift; @@ -65,6 +81,10 @@ sub mod { $scope; } +=head2 C + +=cut + sub body { my $scope = shift; @@ -80,6 +100,10 @@ use overload ( '@{}' => 'dereference', ); +=head2 C + +=cut + sub flatten { my ($scope) = @_; @@ -114,6 +138,10 @@ my $inter = Sub::Name::subname('inter' => sub { return \@left, \@common, \@right; }); +=head2 C + +=cut + sub instantiate { my ($scope) = @_; @@ -164,8 +192,16 @@ sub instantiate { return @body; } +=head2 C + +=cut + sub dereference { [ $_[0]->instantiate ] } +=head2 C + +=cut + sub fold { my ($left, $right, $rev) = @_; @@ -183,20 +219,12 @@ sub fold { ); my $has_different_layers; - for (@$only_left) { + for (@$only_left, @$only_right) { if ($_->type eq 'layer') { $has_different_layers = 1; last; } } - unless ($has_different_layers) { - for (@$only_right) { - if ($_->type eq 'layer') { - $has_different_layers = 1; - last; - } - } - } if (!$has_different_layers and @$common) { my $x = $left->new @@ -232,6 +260,10 @@ sub fold { __PACKAGE__->meta->make_immutable; +=head1 SEE ALSO + +L. + =head1 AUTHOR Vincent Pit, C<< >>, L.