From: Jesse Luehrs Date: Wed, 19 Aug 2009 02:21:17 +0000 (-0500) Subject: empty -> is_empty X-Git-Tag: 0.89_02~55 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1853a27e1534e9b5fd73c83a636cda8603eec63f;p=gitmo%2FMoose.git empty -> is_empty --- diff --git a/lib/Moose/Manual/Delta.pod b/lib/Moose/Manual/Delta.pod index 44b32f9..39e7584 100644 --- a/lib/Moose/Manual/Delta.pod +++ b/lib/Moose/Manual/Delta.pod @@ -40,11 +40,11 @@ generalized to apply to all cases of C<< handles => HASHREF >>, though not every piece of functionality has been ported (currying with a CODEREF is not supported). -=item C now means empty, not non-empty +=item C is now C, and means empty, not non-empty Previously, the C method provided by Arrays and Hashes returned true if the attribute was B empty (no elements). Now it returns true if the -attribute B empty. +attribute B empty. It was also renamed to C, to reflect this. =item C was renamed to C, and C was renamed to C diff --git a/lib/Moose/Meta/Attribute/Native/MethodProvider/Array.pm b/lib/Moose/Meta/Attribute/Native/MethodProvider/Array.pm index 9a6dd13..4181fc8 100644 --- a/lib/Moose/Meta/Attribute/Native/MethodProvider/Array.pm +++ b/lib/Moose/Meta/Attribute/Native/MethodProvider/Array.pm @@ -12,7 +12,7 @@ sub count : method { }; } -sub empty : method { +sub is_empty : method { my ( $attr, $reader, $writer ) = @_; return sub { scalar @{ $reader->( $_[0] ) } ? 0 : 1; diff --git a/lib/Moose/Meta/Attribute/Native/Trait/Array.pm b/lib/Moose/Meta/Attribute/Native/Trait/Array.pm index 9c9f8ce..2258d10 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/Array.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/Array.pm @@ -52,7 +52,7 @@ Moose::Meta::Attribute::Native::Trait::Array get_option => 'get', join_options => 'join', count_options => 'count', - has_no_options => 'empty', + has_no_options => 'is_empty', sorted_options => 'sort', } ); @@ -82,7 +82,7 @@ Returns the number of elements in the array. my $count = $stuff->count_options; print "$count\n"; # prints 4 -=item B +=item B Returns a boolean value indicating whether or not the array has any elements. diff --git a/t/070_native_traits/202_trait_array.t b/t/070_native_traits/202_trait_array.t index 4d6b755..4c745ec 100644 --- a/t/070_native_traits/202_trait_array.t +++ b/t/070_native_traits/202_trait_array.t @@ -27,7 +27,7 @@ my $sort; 'get_option_at' => 'get', 'set_option_at' => 'set', 'num_options' => 'count', - 'has_no_options' => 'empty', + 'has_no_options' => 'is_empty', 'clear_options' => 'clear', 'splice_options' => 'splice', 'sort_options_in_place' => 'sort_in_place', @@ -255,7 +255,7 @@ is_deeply( 'get_option_at' => 'get', 'set_option_at' => 'set', 'num_options' => 'count', - 'has_no_options' => 'empty', + 'has_no_options' => 'is_empty', 'clear_options' => 'clear', 'splice_options' => 'splice', 'sort_options_in_place' => 'sort_in_place', diff --git a/t/070_native_traits/205_trait_list.t b/t/070_native_traits/205_trait_list.t index 80240bf..8f0be38 100644 --- a/t/070_native_traits/205_trait_list.t +++ b/t/070_native_traits/205_trait_list.t @@ -22,7 +22,7 @@ my $up; default => sub { [] }, handles => { 'num_options' => 'count', - 'has_no_options' => 'empty', + 'has_no_options' => 'is_empty', 'map_options', => 'map', 'filter_options' => 'grep', 'find_option' => 'first', @@ -119,7 +119,7 @@ is_deeply( $options->handles, { 'num_options' => 'count', - 'has_no_options' => 'empty', + 'has_no_options' => 'is_empty', 'map_options', => 'map', 'filter_options' => 'grep', 'find_option' => 'first',