$self->{'attributes'}{$attr->name} = $attr;
}
-sub attributes { values %{ $_[0]->{'attributes'} } }
sub get_attribute_map { $_[0]->{attributes} }
sub get_attribute { $_[0]->{attributes}->{$_[1]} }
Begins keeping track of the existing L<Mouse::Attribute> for the owner class.
-=head2 attributes -> [Mouse::Attribute]
-
-Returns a list of L<Mouse::Attribute> objects.
-
=head2 get_attribute_map -> { name => Mouse::Attribute }
Returns a mapping of attribute names to their corresponding
my %args = @_;
my $instance = bless {}, $class;
- for my $attribute ($class->meta->attributes) {
+ for my $attribute (values %{ $class->meta->get_attribute_map }) {
my $key = $attribute->init_arg;
my $default;
};
can_ok(Class => qw/a b c/);
-is(Class->meta->attributes, 3, "three attributes created");
+is(keys %{ Class->meta->get_attribute_map }, 3, "three attributes created");
Class->new(a => 1, b => 2);
is_deeply(\%trigger, { a => 1, b => 1 }, "correct triggers called");
my $meta2 = Class->meta;
is($meta, $meta2, "same metaclass instance");
-can_ok($meta, 'name', 'attributes', 'get_attribute_map');
+can_ok($meta, 'name', 'get_attribute_map');
my $attr = $meta->get_attribute('pawn');
isa_ok($attr, 'Mouse::Attribute');