Provide an "elements" for Collection::List
[gitmo/MooseX-AttributeHelpers.git] / lib / MooseX / AttributeHelpers / MethodProvider / List.pm
index 949981a..7e3c6cb 100644 (file)
@@ -45,6 +45,14 @@ sub grep : method {
     };
 }
 
+sub elements : method {
+    my ($attr, $reader, $writer) = @_;
+    return sub {
+        my ($instance, $f) = @_;
+        @{$reader->($instance)}
+    };
+}
+
 1;
 
 __END__
@@ -82,6 +90,8 @@ L<MooseX::AttributeHelpers::Collection::List>.
 
 =item B<map>
 
+=item B<elements>
+
 =back
 
 =head1 BUGS