NAME

UR::Role::Prototype - Implementation for defining and composing roles

DESCRIPTION

Basic info about using roles is described in the documentation for UR::Role.

When a role is defined using the role keyword, it creates a UR::Role::Prototype instance. Role prototypes represent an uncomposed role. They have most of the same properties as UR::Object::Type instances.

Methods

property_data($property_name)

Returns a hashref of property data about the named property.

has_property_names()

Returns a list of all the properties named in the role's has.

id_by_property_names()

Returns a list of all the properties named in the roles's id_by.

method_names()

Returns a list of all the function names in the role's namespace.

define(%role_definition)

Define a role and return the role prototype.

role_name()

Return the name of the role.

class_names()

Returns a list of the names of the classes composing this role.

requires()

Returns an arrayref of strings. These strings must exist in composing classes, either as properties or methods.

excludes()

Returns an arrayref of role names that may not be composed with this role.

Role namespace methods

When a role is defined, these methods are injected into the role's namespace

create(%params)

Return a UR::Role::PrototypeWithParams object representing this role with a set of params immediately before it is composed into a class. See the section on Parameterized Roles in UR::Role.

__role__()

Calls the above create() method with no arguments. This is used by the role composition mechanism to trigger autoloading the role's module when role names are given as strings in a class definition.

SEE ALSO

UR, UR::Object::Type::Initializer, UR::Role::Instance, UR::Role::PrototypeWithParams