Moose compat: Rename attribute->class to attribute->associated_class
Shawn M Moore [Wed, 16 Jul 2008 06:19:02 +0000 (06:19 +0000)]
lib/Mouse/Meta/Attribute.pm
t/101-meta-attribute.t

index 225ea59..0d7f824 100644 (file)
@@ -20,22 +20,22 @@ sub new {
     bless \%args, $class;
 }
 
-sub name              { $_[0]->{name}            }
-sub class             { $_[0]->{class}           }
-sub _is_metadata      { $_[0]->{is}              }
-sub is_required       { $_[0]->{required}        }
-sub default           { $_[0]->{default}         }
-sub is_lazy           { $_[0]->{lazy}            }
-sub is_lazy_build     { $_[0]->{lazy_build}      }
-sub predicate         { $_[0]->{predicate}       }
-sub clearer           { $_[0]->{clearer}         }
-sub handles           { $_[0]->{handles}         }
-sub is_weak_ref       { $_[0]->{weak_ref}        }
-sub init_arg          { $_[0]->{init_arg}        }
-sub type_constraint   { $_[0]->{type_constraint} }
-sub trigger           { $_[0]->{trigger}         }
-sub builder           { $_[0]->{builder}         }
-sub should_auto_deref { $_[0]->{auto_deref}      }
+sub name              { $_[0]->{name}             }
+sub associated_class  { $_[0]->{associated_class} }
+sub _is_metadata      { $_[0]->{is}               }
+sub is_required       { $_[0]->{required}         }
+sub default           { $_[0]->{default}          }
+sub is_lazy           { $_[0]->{lazy}             }
+sub is_lazy_build     { $_[0]->{lazy_build}       }
+sub predicate         { $_[0]->{predicate}        }
+sub clearer           { $_[0]->{clearer}          }
+sub handles           { $_[0]->{handles}          }
+sub is_weak_ref       { $_[0]->{weak_ref}         }
+sub init_arg          { $_[0]->{init_arg}         }
+sub type_constraint   { $_[0]->{type_constraint}  }
+sub trigger           { $_[0]->{trigger}          }
+sub builder           { $_[0]->{builder}          }
+sub should_auto_deref { $_[0]->{auto_deref}       }
 
 sub has_default         { exists $_[0]->{default}         }
 sub has_predicate       { exists $_[0]->{predicate}       }
@@ -184,7 +184,7 @@ sub create {
     my ($self, $class, $name, %args) = @_;
 
     $args{name} = $name;
-    $args{class} = $class;
+    $args{associated_class} = $class;
 
     %args = $self->canonicalize_args($name, %args);
     $self->validate_args($name, \%args);
@@ -375,7 +375,7 @@ installed. Some error checking is done.
 
 =head2 name -> AttributeName
 
-=head2 class -> OwnerClass
+=head2 associated_class -> OwnerClass
 
 =head2 is_required -> Bool
 
index cef1e3a..f32db9d 100644 (file)
@@ -23,9 +23,9 @@ isa_ok($meta, 'Mouse::Meta::Class');
 my $attr = $meta->get_attribute('pawn');
 isa_ok($attr, 'Mouse::Meta::Attribute');
 
-can_ok($attr, qw(name class predicate clearer));
+can_ok($attr, qw(name associated_class predicate clearer));
 is($attr->name, 'pawn', 'attribute name');
-is($attr->class, 'Class', 'attached class');
+is($attr->associated_class, 'Class', 'associated_class');
 is($attr->predicate, 'has_pawn', 'predicate');
 is($attr->clearer, 'clear_pawn', 'clearer');
 ok(!$attr->is_lazy_build, "not lazy_build");