class_of in Class type constraint
[gitmo/Moose.git] / lib / Moose / Meta / TypeConstraint / Role.pm
index dcb4efa..00b60ac 100644 (file)
@@ -7,7 +7,7 @@ use metaclass;
 use Scalar::Util 'blessed';
 use Moose::Util::TypeConstraints ();
 
-our $VERSION   = '0.71_01';
+our $VERSION   = '0.73';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -110,31 +110,56 @@ __END__
 
 Moose::Meta::TypeConstraint::Role - Role/TypeConstraint parallel hierarchy
 
+=head1 DESCRIPTION
+
+This class represents type constraints for a role.
+
+=head1 INHERITANCE
+
+C<Moose::Meta::TypeConstraint::Role> is a subclass of
+L<Moose::Meta::TypeConstraint>.
+
 =head1 METHODS
 
 =over 4
 
-=item B<new>
+=item B<< Moose::Meta::TypeConstraint::Role->new(%options) >>
+
+This creates a new role type constraint based on the given
+C<%options>.
+
+It takes the same options as its parent, with two exceptions. First,
+it requires an additional option, C<role>, which is name of the
+constraint's role.  Second, it automatically sets the parent to the
+C<Object> type.
+
+The constructor also overrides the hand optimized type constraint with
+one it creates internally.
 
-=item B<role>
+=item B<< $constraint->role >>
 
-=item B<hand_optimized_type_constraint>
+Returns the role name associated with the constraint.
 
-=item B<has_hand_optimized_type_constraint>
+=item B<< $constraint->parents >>
 
-=item B<equals>
+Returns all the type's parent types, corresponding to the roles that
+its role does.
 
-=item B<is_a_type_of>
+=item B<< $constraint->is_subtype_of($type_name_or_object) >>
 
-=item B<is_subtype_of>
+If the given type is also a role type, then this checks that the
+type's role does the other type's role.
 
-=item B<create_child_type>
+Otherwise it falls back to the implementation in
+L<Moose::Meta::TypeConstraint>.
 
-=item B<parents>
+=item B<< $constraint->create_child_type(%options) >>
 
-Return all the parent types, corresponding to the parent classes.
+This returns a new L<Moose::Meta::TypeConstraint> object with the type
+as its parent.
 
-=item B<meta>
+Note that it does I<not> return a C<Moose::Meta::TypeConstraint::Role>
+object!
 
 =back