From: Vincent Pit Date: Thu, 27 Jan 2011 14:26:47 +0000 (+0100) Subject: Rename LT::Set::Mutable to ::Container X-Git-Tag: rt87282~18 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLaTeX-TikZ.git;a=commitdiff_plain;h=1c53f7e28198adfb2905667acd5741f163832d7b Rename LT::Set::Mutable to ::Container And makes it require kids(). --- diff --git a/MANIFEST b/MANIFEST index 01e994a..a4f505f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -27,8 +27,8 @@ lib/LaTeX/TikZ/Set.pm lib/LaTeX/TikZ/Set/Arc.pm lib/LaTeX/TikZ/Set/Arrow.pm lib/LaTeX/TikZ/Set/Circle.pm +lib/LaTeX/TikZ/Set/Container.pm lib/LaTeX/TikZ/Set/Line.pm -lib/LaTeX/TikZ/Set/Mutable.pm lib/LaTeX/TikZ/Set/Path.pm lib/LaTeX/TikZ/Set/Point.pm lib/LaTeX/TikZ/Set/Polyline.pm diff --git a/lib/LaTeX/TikZ/Formatter.pm b/lib/LaTeX/TikZ/Formatter.pm index a5bda82..afdbd38 100644 --- a/lib/LaTeX/TikZ/Formatter.pm +++ b/lib/LaTeX/TikZ/Formatter.pm @@ -212,10 +212,9 @@ my $find_mods = do { } } - my @subsets = ($set->isa('LaTeX::TikZ::Set::Sequence') - || $set->isa('LaTeX::TikZ::Set::Union')) - ? $set->kids - : (); + my @subsets = $set->does('LaTeX::TikZ::Set::Container') + ? $set->kids + : (); $find_mods_rec->($_, $layers, $others) for @subsets; }); diff --git a/lib/LaTeX/TikZ/Set/Mutable.pm b/lib/LaTeX/TikZ/Set/Container.pm similarity index 70% rename from lib/LaTeX/TikZ/Set/Mutable.pm rename to lib/LaTeX/TikZ/Set/Container.pm index e7518cd..37a56cd 100644 --- a/lib/LaTeX/TikZ/Set/Mutable.pm +++ b/lib/LaTeX/TikZ/Set/Container.pm @@ -1,11 +1,11 @@ -package LaTeX::TikZ::Set::Mutable; +package LaTeX::TikZ::Set::Container; use strict; use warnings; =head1 NAME -LaTeX::TikZ::Set::Mutable - A role for set objects that can be appended to. +LaTeX::TikZ::Set::Container - A role for set objects that are made of subobjects. =head1 VERSION @@ -13,8 +13,20 @@ Version 0.02 =head1 DESCRIPTION -L objects that are mutable consume this role. -This forces them to implement an C method describing how more elements can be added to the set. +L objects that group other objects together consume this role. +This forces them to implement : + +=over 4 + +=item * + +a C method that returns the list of subobjects ; + +=item * + +an C method describing how more elements can be added to the set. + +=back =cut @@ -38,6 +50,7 @@ C requires qw< add + kids >; =head1 SEE ALSO @@ -69,4 +82,4 @@ This program is free software; you can redistribute it and/or modify it under th =cut -1; # End of LaTeX::TikZ::Set::Mutable +1; # End of LaTeX::TikZ::Set::Container diff --git a/lib/LaTeX/TikZ/Set/Sequence.pm b/lib/LaTeX/TikZ/Set/Sequence.pm index c453121..70176a1 100644 --- a/lib/LaTeX/TikZ/Set/Sequence.pm +++ b/lib/LaTeX/TikZ/Set/Sequence.pm @@ -28,13 +28,13 @@ use Any::Moose 'Util::TypeConstraints' =head1 RELATIONSHIPS -This class consumes the L and L roles, and as such implements the L and L methods. +This class consumes the L and L roles, and as such implements the L, L and L methods. =cut with qw< LaTeX::TikZ::Set - LaTeX::TikZ::Set::Mutable + LaTeX::TikZ::Set::Container >; subtype 'LaTeX::TikZ::Set::Sequence::Elements' @@ -113,7 +113,7 @@ __PACKAGE__->meta->make_immutable; =head1 SEE ALSO -L, L, L. +L, L, L. =head1 AUTHOR diff --git a/lib/LaTeX/TikZ/Set/Union.pm b/lib/LaTeX/TikZ/Set/Union.pm index 2648d3d..228a6ff 100644 --- a/lib/LaTeX/TikZ/Set/Union.pm +++ b/lib/LaTeX/TikZ/Set/Union.pm @@ -24,13 +24,13 @@ use Any::Moose; =head1 RELATIONSHIPS -This class consumes the L and L roles, and as such implements the L and L methods. +This class consumes the L and L roles, and as such implements the L, L and L methods. =cut with qw< LaTeX::TikZ::Set::Path - LaTeX::TikZ::Set::Mutable + LaTeX::TikZ::Set::Container >; =head1 ATTRIBUTES @@ -97,7 +97,7 @@ __PACKAGE__->meta->make_immutable; =head1 SEE ALSO -L, L, L. +L, L, L. =head1 AUTHOR diff --git a/t/00-load.t b/t/00-load.t index a821174..52955ab 100644 --- a/t/00-load.t +++ b/t/00-load.t @@ -30,8 +30,8 @@ BEGIN { use_ok( 'LaTeX::TikZ::Set::Arc' ); use_ok( 'LaTeX::TikZ::Set::Arrow' ); use_ok( 'LaTeX::TikZ::Set::Circle' ); + use_ok( 'LaTeX::TikZ::Set::Container' ); use_ok( 'LaTeX::TikZ::Set::Line' ); - use_ok( 'LaTeX::TikZ::Set::Mutable' ); use_ok( 'LaTeX::TikZ::Set::Path' ); use_ok( 'LaTeX::TikZ::Set::Point' ); use_ok( 'LaTeX::TikZ::Set::Polyline' ); diff --git a/t/92-pod-coverage.t b/t/92-pod-coverage.t index f6cc91b..b56e464 100644 --- a/t/92-pod-coverage.t +++ b/t/92-pod-coverage.t @@ -45,8 +45,8 @@ pod_coverage_ok( 'LaTeX::TikZ::Set' ); pod_coverage_ok( 'LaTeX::TikZ::Set::Arc' ); pod_coverage_ok( 'LaTeX::TikZ::Set::Arrow' ); pod_coverage_ok( 'LaTeX::TikZ::Set::Circle' ); +pod_coverage_ok( 'LaTeX::TikZ::Set::Container' ); pod_coverage_ok( 'LaTeX::TikZ::Set::Line' ); -pod_coverage_ok( 'LaTeX::TikZ::Set::Mutable' ); pod_coverage_ok( 'LaTeX::TikZ::Set::Path' ); pod_coverage_ok( 'LaTeX::TikZ::Set::Point' ); pod_coverage_ok( 'LaTeX::TikZ::Set::Polyline' );