summaryrefslogtreecommitdiff
path: root/lib/Data/MultiValued/AttributeTrait/Tags.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data/MultiValued/AttributeTrait/Tags.pm')
-rw-r--r--lib/Data/MultiValued/AttributeTrait/Tags.pm28
1 files changed, 24 insertions, 4 deletions
diff --git a/lib/Data/MultiValued/AttributeTrait/Tags.pm b/lib/Data/MultiValued/AttributeTrait/Tags.pm
index cb501e3..36851b5 100644
--- a/lib/Data/MultiValued/AttributeTrait/Tags.pm
+++ b/lib/Data/MultiValued/AttributeTrait/Tags.pm
@@ -1,6 +1,6 @@
package Data::MultiValued::AttributeTrait::Tags;
{
- $Data::MultiValued::AttributeTrait::Tags::VERSION = '0.0.6_2';
+ $Data::MultiValued::AttributeTrait::Tags::VERSION = '0.0.7_1';
}
{
$Data::MultiValued::AttributeTrait::Tags::DIST = 'Data-MultiValued';
@@ -17,9 +17,22 @@ sub multivalue_storage_class { 'Data::MultiValued::Tags' };
sub opts_to_pass_set { qw(tag) }
sub opts_to_pass_get { qw(tag) }
+sub all_tags {
+ my ($self,$instance) = @_;
+
+ my $storage = $self->get_full_storage($instance);
+ return () unless $storage;
+
+ my @tags = $storage->_storage->all_tags;
+ if ($storage->_storage->_has_default_tag) {
+ push @tags,undef;
+ }
+ return @tags;
+}
+
package Moose::Meta::Attribute::Custom::Trait::MultiValued::Tags;
{
- $Moose::Meta::Attribute::Custom::Trait::MultiValued::Tags::VERSION = '0.0.6_2';
+ $Moose::Meta::Attribute::Custom::Trait::MultiValued::Tags::VERSION = '0.0.7_1';
}
{
$Moose::Meta::Attribute::Custom::Trait::MultiValued::Tags::DIST = 'Data-MultiValued';
@@ -30,6 +43,7 @@ sub register_implementation { 'Data::MultiValued::AttributeTrait::Tags' }
1;
__END__
+
=pod
=encoding utf-8
@@ -40,7 +54,7 @@ Data::MultiValued::AttributeTrait::Tags - attribute traits for attributes holdin
=head1 VERSION
-version 0.0.6_2
+version 0.0.7_1
=head1 SYNOPSIS
@@ -75,6 +89,13 @@ Returns C<('tag')>.
Returns C<('tag')>.
+=head2 C<all_tags>
+
+ my @tags = $obj->meta->get_attribute('my_attr')->all_tags($obj);
+
+Returns a list of all values for which C<<
+$obj->has_my_attr_multi({tag=>$tag}) >> would return true.
+
=head1 AUTHOR
Gianni Ceccarelli <dakkar@thenautilus.net>
@@ -87,4 +108,3 @@ This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
-