Composite now implemented.
[gitmo/MooseX-AttributeHelpers.git] / lib / MooseX / AttributeHelpers / Collection / Bag.pm
index 48bb388..96d0ba8 100644 (file)
@@ -1,41 +1,19 @@
-
 package MooseX::AttributeHelpers::Collection::Bag;
 use Moose;
-use Moose::Util::TypeConstraints;
+use MooseX::AttributeHelpers::MethodProvider::Collection::Bag;
 
 our $VERSION   = '0.01';
 our $AUTHORITY = 'cpan:STEVAN';
 
-use MooseX::AttributeHelpers::MethodProvider::Bag;
-
 extends 'MooseX::AttributeHelpers::Collection';
 
-has '+method_provider' => (
-    default => 'MooseX::AttributeHelpers::MethodProvider::Bag'
+__PACKAGE__->sugar(
+    default_options  => { default => sub { {} } },
+    method_provider  => 'Collection::Bag',
+    shortcut         => 'Collection::Bag',
 );
 
-subtype 'Bag' => as 'HashRef[Int]';
-
-sub helper_type { 'Bag' }
-
-before 'process_options_for_provides' => sub {
-    my ($self, $options, $name) = @_;
-
-    # Set some default attribute options here unless already defined
-    if ((my $type = $self->helper_type) && !exists $options->{isa}){
-        $options->{isa} = $type;
-    }
-    
-    $options->{default} = sub { +{} } unless exists $options->{default};
-};
-
 no Moose;
-no Moose::Util::TypeConstraints;
-
-# register the alias ...
-package # hide me from search.cpan.org
-    Moose::Meta::Attribute::Custom::Collection::Bag;
-sub register_implementation { 'MooseX::AttributeHelpers::Collection::Bag' }
 
 1;
 
@@ -72,21 +50,10 @@ This module provides a Bag attribute which provides a number of
 bag-like operations. See L<MooseX::AttributeHelpers::MethodProvider::Bag>
 for more details.
 
-=head1 METHODS
-
-=over 4
-
-=item B<meta>
-
-=item B<method_provider>
-
-=item B<has_method_provider>
-
-=item B<helper_type>
-
-=item B<process_options_for_provides>
+=head1 PROVIDED METHODS
 
-=back
+The methods for this metaclass are provided by
+L<MooseX::AttributeHelpers::MethodProvider::Bag>.
 
 =head1 BUGS
 
@@ -107,4 +74,4 @@ L<http://www.iinteractive.com>
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
-=cut
\ No newline at end of file
+=cut