remove head, tail, and last as Array helpers
[gitmo/Moose.git] / lib / Moose / Meta / Attribute / Native / Trait / Array.pm
index 68f6486..139fccf 100644 (file)
@@ -46,13 +46,10 @@ Moose::Meta::Attribute::Native::Trait::Array
            map_options          => 'map',
            filter_options       => 'grep',
            find_option          => 'first',
-           first_option         => 'head',
-           all_but_first_option => 'tail',
-           last_option          => 'last',
            get_option           => 'get',
            join_options         => 'join',
            count_options        => 'count',
-           has_no_options       => 'empty',
+           has_no_options       => 'is_empty',
            sorted_options       => 'sort',
        }
     );
@@ -82,7 +79,7 @@ Returns the number of elements in the array.
    my $count = $stuff->count_options;
    print "$count\n"; # prints 4
 
-=item B<empty>
+=item B<is_empty>
 
 Returns a boolean value indicating whether or not the array has any elements.
 
@@ -122,7 +119,7 @@ done with a subroutine reference you pass to this method. The reference will
 be called against each element in the array until one matches or all elements
 have been checked.
 
-   my $found = $stuff->find_option( sub { $_[0] =~ /^b/ } );
+   my $found = $stuff->find_option( sub { /^b/ } );
    print "$found\n"; # prints "bar"
 
 =item B<grep( sub { ... } )>
@@ -131,7 +128,7 @@ This method returns every element matching a given criteria, just like Perl's
 core C<grep> function. This method requires a subroutine which implements the
 matching logic.
 
-   my @found = $stuff->filter_options( sub { $_[0] =~ /^b/ } );
+   my @found = $stuff->filter_options( sub { /^b/ } );
    print "@found\n"; # prints "bar baz boo"
 
 =item B<map( sub { ... } )>
@@ -140,7 +137,7 @@ This method transforms every element in the array and returns a new array,
 just like Perl's core C<map> function. This method requires a subroutine which
 implements the transformation.
 
-   my @mod_options = $stuff->map_options( sub { $_[0] . "-tag" } );
+   my @mod_options = $stuff->map_options( sub { $_ . "-tag" } );
    print "@mod_options\n"; # prints "foo-tag bar-tag baz-tag boo-tag"
 
 =item B<sort( sub { ... } )>
@@ -190,27 +187,6 @@ Inserts a new element into the array at the given index.
 
 Empties the entire array, like C<@array = ()>.
 
-=item B<head>
-
-Returns the first element of the array.
-
-   my $first = $stuff->first_option;
-   print "$first\n"; # prints "foo"
-
-=item B<tail>
-
-Returns all elements of the array after the first.
-
-   my @tail = $stuff->all_but_first_option;
-   print join(', ', @tail), "\n"; # prints "bar, baz, boo"
-
-=item B<last>
-
-Returns the last element of the array.
-
-   my $last = $stuff->last_option;
-   print "$last\n"; # prints "boo"
-
 =item B<accessor>
 
 This method provides a get/set accessor for the array, based on array indexes.