summaryrefslogtreecommitdiff
path: root/lib/Data/MultiValued/AttributeTrait/Ranges.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data/MultiValued/AttributeTrait/Ranges.pm')
-rw-r--r--lib/Data/MultiValued/AttributeTrait/Ranges.pm26
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/Data/MultiValued/AttributeTrait/Ranges.pm b/lib/Data/MultiValued/AttributeTrait/Ranges.pm
index bb289f5..d8aaeef 100644
--- a/lib/Data/MultiValued/AttributeTrait/Ranges.pm
+++ b/lib/Data/MultiValued/AttributeTrait/Ranges.pm
@@ -1,6 +1,6 @@
package Data::MultiValued::AttributeTrait::Ranges;
{
- $Data::MultiValued::AttributeTrait::Ranges::VERSION = '0.0.6_2';
+ $Data::MultiValued::AttributeTrait::Ranges::VERSION = '0.0.7_1';
}
{
$Data::MultiValued::AttributeTrait::Ranges::DIST = 'Data-MultiValued';
@@ -17,9 +17,18 @@ sub multivalue_storage_class { 'Data::MultiValued::Ranges' };
sub opts_to_pass_set { qw(from to) }
sub opts_to_pass_get { qw(at) }
+sub all_ranges {
+ my ($self,$instance) = @_;
+
+ my $storage = $self->get_full_storage($instance);
+ return unless $storage;
+
+ return $storage->_storage->all_ranges;
+}
+
package Moose::Meta::Attribute::Custom::Trait::MultiValued::Ranges;
{
- $Moose::Meta::Attribute::Custom::Trait::MultiValued::Ranges::VERSION = '0.0.6_2';
+ $Moose::Meta::Attribute::Custom::Trait::MultiValued::Ranges::VERSION = '0.0.7_1';
}
{
$Moose::Meta::Attribute::Custom::Trait::MultiValued::Ranges::DIST = 'Data-MultiValued';
@@ -30,6 +39,7 @@ sub register_implementation { 'Data::MultiValued::AttributeTrait::Ranges' }
1;
__END__
+
=pod
=encoding utf-8
@@ -40,7 +50,7 @@ Data::MultiValued::AttributeTrait::Ranges - attribute traits for attributes hold
=head1 VERSION
-version 0.0.6_2
+version 0.0.7_1
=head1 SYNOPSIS
@@ -75,6 +85,15 @@ Returns C<('from', 'to')>.
Returns C<('at')>.
+=head2 C<all_ranges>
+
+ my @ranges = $obj->meta->get_attribute('my_attr')->all_ranges($obj);
+
+Returns a list of 2-element arrayrefs, each arrayref describing the
+extremes of a range. Something like:
+
+ [ [undef,10], [10,20], [20,undef] ]
+
=head1 AUTHOR
Gianni Ceccarelli <dakkar@thenautilus.net>
@@ -87,4 +106,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
-